"""empty message

Revision ID: 02b437bb2bf5
Revises: 
Create Date: 2020-09-27 18:27:30.084698

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

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('blacklist_tokens',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('token', sa.String(length=500), nullable=False),
    sa.Column('blacklisted_on', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_blacklist_tokens_token'), 'blacklist_tokens', ['token'], unique=True)
    op.create_table('movies',
    sa.Column('id', models.GUID(length=32), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('director', sa.String(length=80), nullable=False),
    sa.Column('popularity', mysql.FLOAT(precision=10, scale=1), nullable=True),
    sa.Column('genre', sa.Text(), nullable=False),
    sa.Column('imdb_score', mysql.FLOAT(precision=10, scale=1), nullable=True),
    sa.Column('views', sa.Integer(), nullable=True),
    sa.Column('created_by', models.GUID(length=32), nullable=True),
    sa.Column('updated_by', models.GUID(length=32), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['created_by'], ['admin_users.id'], ),
    sa.ForeignKeyConstraint(['updated_by'], ['admin_users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_movies_director'), 'movies', ['director'], unique=False)
    op.create_index(op.f('ix_movies_name'), 'movies', ['name'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_movies_name'), table_name='movies')
    op.drop_index(op.f('ix_movies_director'), table_name='movies')
    op.drop_table('movies')
    op.drop_index(op.f('ix_blacklist_tokens_token'), table_name='blacklist_tokens')
    op.drop_table('blacklist_tokens')
    # ### end Alembic commands ###
