banana-video/alembic/versions/9957de01a152_add_soft_delete.py
2025-08-31 18:38:41 +08:00

43 lines
1.8 KiB
Python

"""add soft delete
Revision ID: 9957de01a152
Revises: 2a45d85dda67
Create Date: 2025-08-29 10:53:33.843499
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9957de01a152'
down_revision = '2a45d85dda67'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('assets', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True))
op.create_index(op.f('ix_assets_deleted_at'), 'assets', ['deleted_at'], unique=False)
op.add_column('projects', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True))
op.create_index(op.f('ix_projects_deleted_at'), 'projects', ['deleted_at'], unique=False)
op.add_column('prompts', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True))
op.create_index(op.f('ix_prompts_deleted_at'), 'prompts', ['deleted_at'], unique=False)
op.add_column('storyboards', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True))
op.create_index(op.f('ix_storyboards_deleted_at'), 'storyboards', ['deleted_at'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_storyboards_deleted_at'), table_name='storyboards')
op.drop_column('storyboards', 'deleted_at')
op.drop_index(op.f('ix_prompts_deleted_at'), table_name='prompts')
op.drop_column('prompts', 'deleted_at')
op.drop_index(op.f('ix_projects_deleted_at'), table_name='projects')
op.drop_column('projects', 'deleted_at')
op.drop_index(op.f('ix_assets_deleted_at'), table_name='assets')
op.drop_column('assets', 'deleted_at')
# ### end Alembic commands ###