PCv5/migrations/versions/b890d9bb207b_remove_thread_...

35 lines
1.2 KiB
Python

"""Remove Thread references
Revision ID: b890d9bb207b
Revises: 2a1165f6ad0a
Create Date: 2019-09-08 12:29:38.650491
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b890d9bb207b'
down_revision = '2a1165f6ad0a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('comment_thread_id_fkey', 'comment', type_='foreignkey')
op.drop_column('comment', 'thread_id')
op.drop_constraint('topic_thread_id_fkey', 'topic', type_='foreignkey')
op.drop_column('topic', 'thread_id')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('topic', sa.Column('thread_id', sa.INTEGER(), autoincrement=False, nullable=False))
op.create_foreign_key('topic_thread_id_fkey', 'topic', 'thread', ['thread_id'], ['id'])
op.add_column('comment', sa.Column('thread_id', sa.INTEGER(), autoincrement=False, nullable=False))
op.create_foreign_key('comment_thread_id_fkey', 'comment', 'thread', ['thread_id'], ['id'])
# ### end Alembic commands ###