39 lines
962 B
Python
39 lines
962 B
Python
"""allow unlimited tenant storage quota sentinel
|
|
|
|
Revision ID: j002_unlimited_tenant_quota
|
|
Revises: j001_comments_fix
|
|
Create Date: 2026-03-25
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "j002_unlimited_tenant_quota"
|
|
down_revision: Union[str, None] = "j001_comments_fix"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
CONSTRAINT_NAME = "ck_tenants_storage_quota_bytes_positive"
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.drop_constraint(CONSTRAINT_NAME, "tenants", type_="check")
|
|
op.create_check_constraint(
|
|
CONSTRAINT_NAME,
|
|
"tenants",
|
|
"storage_quota_bytes = -1 OR storage_quota_bytes > 0",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_constraint(CONSTRAINT_NAME, "tenants", type_="check")
|
|
op.create_check_constraint(
|
|
CONSTRAINT_NAME,
|
|
"tenants",
|
|
"storage_quota_bytes > 0",
|
|
)
|