"""Add WebPage Model

Revision ID: fdacae9b58ac
Revises: c8b2a201d0db
Create Date: 2018-06-22 10:29:35.410285

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('web_page',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('key', sa.String(length=128), nullable=True),
    sa.Column('parsed_datetime', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_web_page_key'), 'web_page', ['key'], unique=False)
    op.add_column('rotten_movie', sa.Column('web_page_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'rotten_movie', 'web_page', ['web_page_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'rotten_movie', type_='foreignkey')
    op.drop_column('rotten_movie', 'web_page_id')
    op.drop_index(op.f('ix_web_page_key'), table_name='web_page')
    op.drop_table('web_page')
    # ### end Alembic commands ###
