"""Create administrators table

Revision ID: 6fe130518448
Revises: 40cbd3e0f22d
Create Date: 2017-07-22 02:00:35.317471

"""

# revision identifiers, used by Alembic.
revision = '6fe130518448'
down_revision = '40cbd3e0f22d'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('administrators',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.alter_column(u'cosmetics', 'css',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.alter_column(u'guild_members', 'active',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guild_members', 'banned',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column(u'guilds', 'bracket_links',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guilds', 'channels',
               existing_type=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'chat_links',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guilds', 'emojis',
               existing_type=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'roles',
               existing_type=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'unauth_users',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guilds', 'visitor_view',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.alter_column(u'guilds', 'webhooks',
               existing_type=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column(u'unauthenticated_users', 'revoked',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column(u'user_css', 'css',
               existing_type=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(u'user_css', 'css',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column(u'unauthenticated_users', 'revoked',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column(u'guilds', 'webhooks',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'visitor_view',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    op.alter_column(u'guilds', 'unauth_users',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guilds', 'roles',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'emojis',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'chat_links',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guilds', 'channels',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.LONGTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column(u'guilds', 'bracket_links',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'guild_members', 'banned',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column(u'guild_members', 'active',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column(u'cosmetics', 'css',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    op.drop_table('administrators')
    # ### end Alembic commands ###
