"""remove link polymorphism

Revision ID: d363aeb3c4de
Revises: a49797d68d62
Create Date: 2016-09-25 01:01:56.204651

"""

# revision identifiers, used by Alembic.
revision = 'd363aeb3c4de'
down_revision = 'a49797d68d62'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('http_link')
    op.drop_table('torrent_link')
    op.add_column('link', sa.Column('checking', sa.Boolean(), nullable=True))
    op.add_column('link', sa.Column('dead', sa.Boolean(), nullable=True))
    op.add_column('link', sa.Column('multipart', sa.Boolean(), nullable=True))
    op.add_column('link', sa.Column('reason', sa.String(), nullable=True))
    op.add_column('link', sa.Column('size', sa.Integer(), nullable=True))
    op.add_column('link', sa.Column('status', sa.Integer(), nullable=True))
    op.add_column('link', sa.Column('time_checked', sa.Integer(), nullable=True))
    op.drop_index('ix_link_real_type', table_name='link')
    op.add_column('release_monitor', sa.Column('download_date_stamp', sa.Integer(), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('release_monitor', sa.Column('torrent_cached', sa.BOOLEAN(), nullable=True))
    op.add_column('link', sa.Column('real_type', sa.VARCHAR(length=24), nullable=False))
    op.create_index('ix_link_real_type', 'link', ['real_type'], unique=False)
    op.create_table('torrent_link',
    sa.Column('created_at', sa.DATETIME(), nullable=True),
    sa.Column('updated_at', sa.DATETIME(), nullable=True),
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('cached', sa.BOOLEAN(), nullable=True),
    sa.Column('dead', sa.BOOLEAN(), nullable=True),
    sa.ForeignKeyConstraint(['id'], ['link.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('http_link',
    sa.Column('status', sa.INTEGER(), nullable=True),
    sa.Column('dead', sa.BOOLEAN(), nullable=True),
    sa.Column('multipart', sa.BOOLEAN(), nullable=True),
    sa.Column('time_checked', sa.INTEGER(), nullable=True),
    sa.Column('checking', sa.BOOLEAN(), nullable=True),
    sa.Column('size', sa.INTEGER(), nullable=True),
    sa.Column('reason', sa.VARCHAR(), nullable=True),
    sa.Column('created_at', sa.DATETIME(), nullable=True),
    sa.Column('updated_at', sa.DATETIME(), nullable=True),
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['id'], ['link.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###
