Publish curated ITWorx-ModelForge source from 990401737f96c8d46a9f7b0d84994516cadcb6a0
This commit is contained in:
1 parent
7082ab955a
commit
848f0d8f8a
434 files changed
+67298
-4315
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"""Fence approved stable serving transitions and rollback against ABA changes."""
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "20260910_0034"
|
||||
down_revision = "20260909_0033"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("capability_contracts", sa.Column(
|
||||
"serving_generation", sa.BigInteger(), nullable=False, server_default="0"))
|
||||
with op.batch_alter_table("capability_contracts") as batch:
|
||||
batch.create_check_constraint("ck_capability_serving_generation", "serving_generation >= 0")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
contracts = sa.table("capability_contracts", sa.column("serving_generation"))
|
||||
if op.get_bind().scalar(sa.select(sa.func.count()).select_from(contracts).where(
|
||||
contracts.c.serving_generation != 0
|
||||
)):
|
||||
raise RuntimeError("Serving route history exists; restore the pre-migration backup instead.")
|
||||
with op.batch_alter_table("capability_contracts") as batch:
|
||||
batch.drop_constraint("ck_capability_serving_generation", type_="check")
|
||||
batch.drop_column("serving_generation")
|
||||
Reference in new issue
Block a user