38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
|
|
"""Add deleted_at column to permissions and share_links tables.
|
||
|
|
|
||
|
|
The Permission and ShareLink models inherit TenantMixin which includes
|
||
|
|
SoftDeleteMixin (deleted_at), but the original plugin migration did not
|
||
|
|
create this column. This migration adds it for existing databases.
|
||
|
|
|
||
|
|
Revision ID: 0031_permissions_soft_delete
|
||
|
|
Revises: 0030_contact_merge_history
|
||
|
|
Create Date: 2025-07-24
|
||
|
|
"""
|
||
|
|
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
# revision identifiers
|
||
|
|
revision = "0031_permissions_soft_delete"
|
||
|
|
down_revision = "0030_contact_merge_history"
|
||
|
|
branch_labels = None
|
||
|
|
depends_on = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade() -> None:
|
||
|
|
# Add deleted_at to permissions table (if not exists)
|
||
|
|
op.add_column(
|
||
|
|
"permissions",
|
||
|
|
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||
|
|
)
|
||
|
|
# Add deleted_at to share_links table (if not exists)
|
||
|
|
op.add_column(
|
||
|
|
"share_links",
|
||
|
|
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade() -> None:
|
||
|
|
op.drop_column("share_links", "deleted_at")
|
||
|
|
op.drop_column("permissions", "deleted_at")
|