fix(migrations): re-issue the 12xx label backfill inside an explicit transaction block (#2422)

* fix(migrations): re-issue the 12xx label backfill inside an explicit transaction block

20260908113353 (PR #2419) used a bare LOCK TABLE. The CI replay
(psql -f per file) and the Supabase branch runner execute migration
statements in autocommit, so Postgres refused it ("LOCK TABLE can only
be used in transaction blocks"): pg-real, pg-upgrade and tool-pg went
red on main and prod's migration queue stopped at that version, which
also blocks 20260908130127 (PR #2420). Prod never recorded 113353, so
the file is replaced rather than edited: same statements wrapped in
BEGIN/COMMIT (precedent 20260513140000), new version 20260908120449.
Applied and pg-tested on staging.

Refs #2413

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NXSuVejFCvRDyNXF1otEPd

* docs(decisions): migrations wrap transaction-only statements in BEGIN/COMMIT

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NXSuVejFCvRDyNXF1otEPd

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-09-08 14:14:51 +02:00
committed by GitHub
co-authored by Claude Fable 5.1
parent e85eac317c
commit 5987523a25
3 changed files with 12 additions and 4 deletions
@@ -5,7 +5,7 @@ import { insertPostedJournalEntry, seedCompany } from '@/tests/pg/fixtures'
import { getPool } from '@/tests/pg/setup'
/**
* pg-real coverage for 20260908113353_backfill_bas2026_retired_12xx_labels.sql
* pg-real coverage for 20260908120449_backfill_bas2026_retired_12xx_labels.sql
* (#2413).
*
* The backfill renames 1249/1259/1269 only where the chart carries the
@@ -22,7 +22,7 @@ import { getPool } from '@/tests/pg/setup'
*/
const BACKFILL_SQL = readFileSync(
join(process.cwd(), 'supabase/migrations/20260908113353_backfill_bas2026_retired_12xx_labels.sql'),
join(process.cwd(), 'supabase/migrations/20260908120449_backfill_bas2026_retired_12xx_labels.sql'),
'utf8',
)