open-law/migrations/versions/ef2254f9bc92_copy_of_fields.py
SvyatoslavArtymovych c8b7878d61 version CUD
2023-06-13 11:34:17 +03:00

51 lines
1.5 KiB
Python

"""copy of fields
Revision ID: ef2254f9bc92
Revises: 03e8384a23e1
Create Date: 2023-06-13 09:43:26.575245
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "ef2254f9bc92"
down_revision = "03e8384a23e1"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("collections", schema=None) as batch_op:
batch_op.add_column(sa.Column("copy_of", sa.Integer(), nullable=True))
with op.batch_alter_table("comments", schema=None) as batch_op:
batch_op.add_column(sa.Column("copy_of", sa.Integer(), nullable=True))
with op.batch_alter_table("interpretations", schema=None) as batch_op:
batch_op.add_column(sa.Column("copy_of", sa.Integer(), nullable=True))
with op.batch_alter_table("sections", schema=None) as batch_op:
batch_op.add_column(sa.Column("copy_of", sa.Integer(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("sections", schema=None) as batch_op:
batch_op.drop_column("copy_of")
with op.batch_alter_table("interpretations", schema=None) as batch_op:
batch_op.drop_column("copy_of")
with op.batch_alter_table("comments", schema=None) as batch_op:
batch_op.drop_column("copy_of")
with op.batch_alter_table("collections", schema=None) as batch_op:
batch_op.drop_column("copy_of")
# ### end Alembic commands ###