"""empty message

Revision ID: cadce5b06ea7
Revises: 5c4a7cc7d0e2
Create Date: 2020-03-25 11:23:09.141719

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

# revision identifiers, used by Alembic.
revision = 'cadce5b06ea7'
down_revision = '5c4a7cc7d0e2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_user_email', table_name='user')
    op.drop_index('ix_user_username', table_name='user')
    op.drop_table('user')
    op.drop_table('followers')
    op.drop_index('ix_post_timestamp', table_name='post')
    op.drop_table('post')
    op.add_column('label_data', sa.Column('is_labeled', sa.Integer(), nullable=True))
    op.create_index(op.f('ix_label_data_is_labeled'), 'label_data', ['is_labeled'], unique=False)
    op.drop_index('ix_label_data_is_labled', table_name='label_data')
    op.drop_column('label_data', 'is_labled')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('label_data', sa.Column('is_labled', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.create_index('ix_label_data_is_labled', 'label_data', ['is_labled'], unique=False)
    op.drop_index(op.f('ix_label_data_is_labeled'), table_name='label_data')
    op.drop_column('label_data', 'is_labeled')
    op.create_table('post',
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('body', mysql.VARCHAR(length=140), nullable=True),
    sa.Column('timestamp', mysql.DATETIME(), nullable=True),
    sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('language', mysql.VARCHAR(length=5), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='post_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_post_timestamp', 'post', ['timestamp'], unique=False)
    op.create_table('followers',
    sa.Column('follower_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('followed_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['followed_id'], ['user.id'], name='followers_ibfk_1'),
    sa.ForeignKeyConstraint(['follower_id'], ['user.id'], name='followers_ibfk_2'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_table('user',
    sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
    sa.Column('username', mysql.VARCHAR(length=64), nullable=True),
    sa.Column('email', mysql.VARCHAR(length=120), nullable=True),
    sa.Column('password_hash', mysql.VARCHAR(length=128), nullable=True),
    sa.Column('about_me', mysql.VARCHAR(length=140), nullable=True),
    sa.Column('last_seen', mysql.DATETIME(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_user_username', 'user', ['username'], unique=True)
    op.create_index('ix_user_email', 'user', ['email'], unique=True)
    # ### end Alembic commands ###
