"""Recreate Thread references

Revision ID: abd5f8de0106
Revises: 4e05b43b18b1
Create Date: 2019-09-08 12:34:12.574672

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'abd5f8de0106'
down_revision = '4e05b43b18b1'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('comment', sa.Column('thread_id', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'comment', 'thread', ['thread_id'], ['id'])
    op.add_column('topic', sa.Column('thread_id', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'topic', 'thread', ['thread_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'topic', type_='foreignkey')
    op.drop_column('topic', 'thread_id')
    op.drop_constraint(None, 'comment', type_='foreignkey')
    op.drop_column('comment', 'thread_id')
    # ### end Alembic commands ###
