Files
docupulse/migrations/versions/add_deleted_column_to_room_file.py
2025-06-02 18:58:48 +02:00

35 lines
1.1 KiB
Python

"""Add deleted column to room_file table
Revision ID: add_deleted_column_to_room_file
Revises: add_trashed_file_table
Create Date: 2024-03-19 10:30:00.000000
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect
# revision identifiers, used by Alembic.
revision = 'add_deleted_column_to_room_file'
down_revision = 'add_trashed_file_table'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
conn = op.get_bind()
inspector = inspect(conn)
columns = [col['name'] for col in inspector.get_columns('room_file')]
if 'deleted' not in columns:
with op.batch_alter_table('room_file', schema=None) as batch_op:
batch_op.add_column(sa.Column('deleted', sa.Boolean(), nullable=False, server_default='false'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('room_file', schema=None) as batch_op:
batch_op.drop_column('deleted')
# ### end Alembic commands ###