majuna/migrations/versions/56fbcfa1138c_record_deprecation_reason.py

55 lines
1.8 KiB
Python
Raw Normal View History

2022-05-01 16:23:45 +01:00
"""record deprecation reason
Revision ID: 56fbcfa1138c
Revises: 22a33ecf3474
Create Date: 2022-05-01 16:13:03.425508
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '56fbcfa1138c'
down_revision = '22a33ecf3474'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('bridge', schema=None) as batch_op:
batch_op.add_column(sa.Column('deprecation_reason', sa.String(), nullable=True))
with op.batch_alter_table('mirror', schema=None) as batch_op:
batch_op.add_column(sa.Column('deprecation_reason', sa.String(), nullable=True))
with op.batch_alter_table('origin', schema=None) as batch_op:
batch_op.add_column(sa.Column('auto_rotation', sa.Boolean(), nullable=True))
with op.batch_alter_table('origin', schema=None) as batch_op:
batch_op.execute("UPDATE origin SET auto_rotation = true")
batch_op.alter_column('auto_rotation', nullable=False)
with op.batch_alter_table('proxy', schema=None) as batch_op:
batch_op.add_column(sa.Column('deprecation_reason', sa.String(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('proxy', schema=None) as batch_op:
batch_op.drop_column('deprecation_reason')
with op.batch_alter_table('origin', schema=None) as batch_op:
batch_op.drop_column('auto_rotation')
with op.batch_alter_table('mirror', schema=None) as batch_op:
batch_op.drop_column('deprecation_reason')
with op.batch_alter_table('bridge', schema=None) as batch_op:
batch_op.drop_column('deprecation_reason')
# ### end Alembic commands ###