"""empty message

Revision ID: be3ae799118d
Revises: 
Create Date: 2018-12-12 14:16:02.919281

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

# revision identifiers, used by Alembic.
revision = 'be3ae799118d'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('area', sa.Column('is_hot', sa.Integer(), nullable=True))
    op.add_column('area', sa.Column('status', sa.Integer(), nullable=True))
    op.alter_column('cinema', 'address',
               existing_type=mysql.VARCHAR(length=255),
               nullable=False)
    op.alter_column('cinema', 'city',
               existing_type=mysql.VARCHAR(length=64),
               nullable=False)
    op.alter_column('cinema', 'district',
               existing_type=mysql.VARCHAR(length=64),
               nullable=False)
    op.alter_column('cinema', 'hall_num',
               existing_type=mysql.INTEGER(display_width=11),
               nullable=False)
    op.alter_column('cinema', 'phone',
               existing_type=mysql.VARCHAR(length=255),
               nullable=False)
    op.add_column('rating', sa.Column('rid', sa.Integer(), autoincrement=True, nullable=False))
    op.drop_constraint('rating_ibfk_1', 'rating', type_='foreignkey')
    op.create_foreign_key(None, 'rating', 'movie', ['movie_id'], ['id'])
    op.drop_column('rating', 'sid')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('rating', sa.Column('sid', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False))
    op.drop_constraint(None, 'rating', type_='foreignkey')
    op.create_foreign_key('rating_ibfk_1', 'rating', 'movie', ['movie_id'], ['id'], ondelete='CASCADE')
    op.drop_column('rating', 'rid')
    op.alter_column('cinema', 'phone',
               existing_type=mysql.VARCHAR(length=255),
               nullable=True)
    op.alter_column('cinema', 'hall_num',
               existing_type=mysql.INTEGER(display_width=11),
               nullable=True)
    op.alter_column('cinema', 'district',
               existing_type=mysql.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cinema', 'city',
               existing_type=mysql.VARCHAR(length=64),
               nullable=True)
    op.alter_column('cinema', 'address',
               existing_type=mysql.VARCHAR(length=255),
               nullable=True)
    op.drop_column('area', 'status')
    op.drop_column('area', 'is_hot')
    # ### end Alembic commands ###
