37 lines
855 B
Python
37 lines
855 B
Python
"""Add resolution_strategy field to tenants table.
|
|
|
|
Revision ID: 0058
|
|
Revises: 0057
|
|
Create Date: 2026-07-29
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0058"
|
|
down_revision = "0057"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"tenants",
|
|
sa.Column(
|
|
"resolution_strategy",
|
|
sa.String(30),
|
|
nullable=False,
|
|
server_default=sa.text("'highest_wins'"),
|
|
),
|
|
)
|
|
op.create_check_constraint(
|
|
"ck_tenant_resolution_strategy",
|
|
"tenants",
|
|
"resolution_strategy IN ('highest_wins', 'deny_overrides_allow', 'direct_overrides_group', 'most_restrictive_wins')",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_constraint("ck_tenant_resolution_strategy", "tenants")
|
|
op.drop_column("tenants", "resolution_strategy")
|