open-law/migrations/versions/8f11cadae6a8_fork.py
2023-06-15 10:09:07 +03:00

35 lines
935 B
Python

"""fork
Revision ID: 8f11cadae6a8
Revises: a8184a265190
Create Date: 2023-06-14 14:18:04.714697
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8f11cadae6a8'
down_revision = 'a8184a265190'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('books', schema=None) as batch_op:
batch_op.add_column(sa.Column('original_book_id', sa.Integer(), nullable=True))
batch_op.create_foreign_key(None, 'books', ['original_book_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('books', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('original_book_id')
# ### end Alembic commands ###