| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- """Add bounded reconciliation claims for Runner and rule evidence."""
- from alembic import op
- revision = "20260723_180"
- down_revision = "20260723_170"
- branch_labels = None
- depends_on = None
- def upgrade() -> None:
- op.execute(
- """
- ALTER TABLE public.runner_task_executions
- ADD COLUMN lease_expires_at TIMESTAMPTZ NOT NULL
- DEFAULT CURRENT_TIMESTAMP;
- ALTER TABLE public.rule_violation_samples
- DROP CONSTRAINT
- rule_violation_samples_handoff_status_check,
- ADD CONSTRAINT
- rule_violation_samples_handoff_status_check
- CHECK (handoff_status IN (
- 'legacy','pending','ready','failed',
- 'unknown','expired'
- )),
- ADD COLUMN cleanup_claim UUID,
- ADD COLUMN schema_fields JSONB;
- CREATE INDEX idx_rule_violation_sample_cleanup_claim
- ON public.rule_violation_samples(
- cleanup_claim, expires_at, id
- );
- ALTER TABLE public.rule_sql_staging_receipts
- ADD COLUMN cleanup_claim UUID;
- CREATE INDEX idx_rule_sql_receipt_cleanup_claim
- ON public.rule_sql_staging_receipts(
- cleanup_claim, expires_at, id
- );
- """
- )
- def downgrade() -> None:
- raise RuntimeError(
- "rule reconciliation claims are forward-only"
- )
|