fix: align migration 206 schema with 201-204 and harden CI#4
Open
mcp-tool-shop wants to merge 2 commits intomainfrom
Open
fix: align migration 206 schema with 201-204 and harden CI#4mcp-tool-shop wants to merge 2 commits intomainfrom
mcp-tool-shop wants to merge 2 commits intomainfrom
Conversation
Migration 206 (impossible state constraints) failed because it referenced wrong table names (psp_balance_reservation, psp_funding_request), used mismatched CHECK constraint enum values vs the CREATE TABLE definitions in 201-203, and referenced liability_event.amount instead of loss_amount. Changes: - Add 204_liability_attribution.sql to psp_build_pack_v2 migrations so migrate.py can find the liability_event table before 206 runs - Fix 206: correct table names (psp_reservation, funding_request) - Fix 206: align all CHECK enums with 201-204 definitions (entry_type, payment status/purpose/payee_type, settlement status, reservation status, funding_request status, liability recovery_status) - Fix 206: use loss_amount instead of amount for liability_event - Fix 206: align status transition trigger JSONB maps with valid statuses - Fix 206: remove duplicate unique indexes already created in 201/202 - CI: add paths filter to avoid unnecessary runs on doc-only changes - CI: add concurrency group with cancel-in-progress - CI: add workflow_dispatch for manual trigger Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…use raw DBAPI execution The `timestamp` column name in psp_domain_event is a PostgreSQL reserved keyword that causes syntax errors in RETURNS TABLE clauses. Quote it as "timestamp" throughout migration 205. Additionally, switch migrate.py from conn.execute(text(sql)) to raw DBAPI cursor execution so that PL/pgSQL percent signs (%ROWTYPE, RAISE EXCEPTION format specifiers) are passed through verbatim to PostgreSQL instead of being interpreted as psycopg2 parameter markers. This also future-proofs migration 206 which has RAISE EXCEPTION '%' patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
psp_balance_reservationinstead ofpsp_reservation,psp_funding_requestinstead offunding_request), used mismatched CHECK constraint enum values vs the CREATE TABLE definitions in migrations 201-203, and theliability_eventtable was missing from thepsp_build_pack_v2migration path entirely.204_liability_attribution.sqltopsp_build_pack_v2/somigrate.pycreates theliability_eventtable before 206 runs. Fixed all CHECK constraint enums in 206 to match their source migrations (entry_type, payment status/purpose/payee_type, settlement status, reservation status, funding_request status, liability recovery_status). Fixedamounttoloss_amountfor liability_event. Aligned status transition trigger JSONB maps. Removed duplicate unique indexes already created in 201/202.paths:filter (pyproject.toml, src/, tests/, psp_build_pack_v2/**, etc.) to prevent CI runs on doc-only changes. Added concurrency group withcancel-in-progress: true. Addedworkflow_dispatch:for manual trigger fallback.Test plan
db-testsjob passes:python scripts/migrate.pyapplies all 6 migrations (201-206) without errorsconstraint-testsjob passes: negative amount insertion is rejected by CHECK constraintmigration-lintjob passes: migration numbering is sequential (201, 202, 203, 204, 205, 206)demo-testjob passes: example runs after migrations applied🤖 Generated with Claude Code