147 lines
7.2 KiB
Python
147 lines
7.2 KiB
Python
|
|
"""add soft delete columns
|
||
|
|
|
||
|
|
Revision ID: 7a0cfda486e1
|
||
|
|
Revises: bf430156bcf2
|
||
|
|
Create Date: 2026-05-01 13:40:24.316892
|
||
|
|
|
||
|
|
"""
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
|
||
|
|
# revision identifiers, used by Alembic.
|
||
|
|
revision = '7a0cfda486e1'
|
||
|
|
down_revision = 'bf430156bcf2'
|
||
|
|
branch_labels = None
|
||
|
|
depends_on = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade():
|
||
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
|
with op.batch_alter_table('boards', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_boards_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('card_labels', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_card_labels_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('card_links', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_card_links_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('cards', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_cards_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('check_items', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_check_items_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('checklists', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_checklists_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('comments', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_comments_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('epics', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_epics_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('file_attachments', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_file_attachments_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('labels', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_labels_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('lists', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_lists_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
with op.batch_alter_table('wikis', schema=None) as batch_op:
|
||
|
|
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=False, server_default='active'))
|
||
|
|
batch_op.add_column(sa.Column('deleted_at', sa.DateTime(), nullable=True))
|
||
|
|
batch_op.create_index(batch_op.f('ix_wikis_status'), ['status'], unique=False)
|
||
|
|
|
||
|
|
# ### end Alembic commands ###
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade():
|
||
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
|
with op.batch_alter_table('wikis', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_wikis_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('lists', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_lists_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('labels', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_labels_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('file_attachments', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_file_attachments_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('epics', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_epics_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('comments', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_comments_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('checklists', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_checklists_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('check_items', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_check_items_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('cards', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_cards_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('card_links', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_card_links_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('card_labels', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_card_labels_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
with op.batch_alter_table('boards', schema=None) as batch_op:
|
||
|
|
batch_op.drop_index(batch_op.f('ix_boards_status'))
|
||
|
|
batch_op.drop_column('deleted_at')
|
||
|
|
batch_op.drop_column('status')
|
||
|
|
|
||
|
|
# ### end Alembic commands ###
|