"""Init

Revision ID: d276909b9d20
Revises: 
Create Date: 2018-06-20 18:05:18.520443

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('rotten_movie',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=150), nullable=True),
    sa.Column('year', sa.Integer(), nullable=True),
    sa.Column('url', sa.String(length=150), nullable=True),
    sa.Column('data', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_rotten_movie_name'), 'rotten_movie', ['name'], unique=False)
    op.create_index(op.f('ix_rotten_movie_url'), 'rotten_movie', ['url'], unique=False)
    op.create_index(op.f('ix_rotten_movie_year'), 'rotten_movie', ['year'], unique=False)
    op.create_table('item',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('dataset', sa.String(length=10), nullable=True),
    sa.Column('key', sa.String(length=10), nullable=True),
    sa.Column('name', sa.String(length=150), nullable=True),
    sa.Column('year', sa.Integer(), nullable=True),
    sa.Column('release_date', sa.Date(), nullable=True),
    sa.Column('video_release_date', sa.Date(), nullable=True),
    sa.Column('old_imdb_url', sa.String(length=1000), nullable=True),
    sa.Column('category_action', sa.Boolean(), nullable=False),
    sa.Column('category_adventure', sa.Boolean(), nullable=False),
    sa.Column('category_animation', sa.Boolean(), nullable=False),
    sa.Column('category_children', sa.Boolean(), nullable=False),
    sa.Column('category_comedy', sa.Boolean(), nullable=False),
    sa.Column('category_crime', sa.Boolean(), nullable=False),
    sa.Column('category_documentary', sa.Boolean(), nullable=False),
    sa.Column('category_drama', sa.Boolean(), nullable=False),
    sa.Column('category_fantasy', sa.Boolean(), nullable=False),
    sa.Column('category_flim_noir', sa.Boolean(), nullable=False),
    sa.Column('category_horror', sa.Boolean(), nullable=False),
    sa.Column('category_musical', sa.Boolean(), nullable=False),
    sa.Column('category_mystery', sa.Boolean(), nullable=False),
    sa.Column('category_romance', sa.Boolean(), nullable=False),
    sa.Column('category_sci_fi', sa.Boolean(), nullable=False),
    sa.Column('category_thriller', sa.Boolean(), nullable=False),
    sa.Column('category_war', sa.Boolean(), nullable=False),
    sa.Column('category_western', sa.Boolean(), nullable=False),
    sa.Column('rotten_movie_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['rotten_movie_id'], ['rotten_movie.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_item_dataset'), 'item', ['dataset'], unique=False)
    op.create_index(op.f('ix_item_key'), 'item', ['key'], unique=False)
    op.create_index(op.f('ix_item_name'), 'item', ['name'], unique=False)
    op.create_index(op.f('ix_item_release_date'), 'item', ['release_date'], unique=False)
    op.create_index(op.f('ix_item_year'), 'item', ['year'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_item_year'), table_name='item')
    op.drop_index(op.f('ix_item_release_date'), table_name='item')
    op.drop_index(op.f('ix_item_name'), table_name='item')
    op.drop_index(op.f('ix_item_key'), table_name='item')
    op.drop_index(op.f('ix_item_dataset'), table_name='item')
    op.drop_table('item')
    op.drop_index(op.f('ix_rotten_movie_year'), table_name='rotten_movie')
    op.drop_index(op.f('ix_rotten_movie_url'), table_name='rotten_movie')
    op.drop_index(op.f('ix_rotten_movie_name'), table_name='rotten_movie')
    op.drop_table('rotten_movie')
    # ### end Alembic commands ###
