fix: add deleted_at to workspace tables (TenantMixin includes SoftDeleteMixin)
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
"""Add deleted_at to workspace tables (TenantMixin includes SoftDeleteMixin).
|
||||||
|
|
||||||
|
Revision ID: 0073
|
||||||
|
Revises: 0072
|
||||||
|
"""
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
revision = "0073"
|
||||||
|
down_revision = "0072"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
TABLES = ["workspaces", "workspace_modules", "workspace_users", "workspace_widgets"]
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
for table in TABLES:
|
||||||
|
op.add_column(table, sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True))
|
||||||
|
op.execute(f"CREATE INDEX IF NOT EXISTS ix_{table}_deleted_at ON {table} (deleted_at)")
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
for table in TABLES:
|
||||||
|
op.drop_index(f"ix_{table}_deleted_at", table_name=table)
|
||||||
|
op.drop_column(table, "deleted_at")
|
||||||
Reference in New Issue
Block a user