feat(db): move the bundled database to Postgres 18

The compose file runs Postgres 18. An install from v1.45 or earlier keeps
its Postgres 16 data in `pgdata`, which 18 cannot open, so a one-shot
`db-upgrade` service moves it on the first start: it starts Postgres 16 on
the old volume inside its own container, streams a dump into 18 in one
transaction, compares every table's row count, gathers planner statistics
and marks the old volume as moved. The app waits for it to succeed.

The old volume is never changed apart from the marker, so the way back is
the previous image and volume lines. A move cut short leaves a "moving"
marker and runs again from scratch; an emptied new volume after a finished
move is refused rather than refilled with the old state.

scripts/compose-db-upgrade-check.sh plays all of it against real
containers from the v1.45.0 compose file, and runs in CI on every change
to the compose file. Pull requests run the integration suite and e2e on
Postgres 18; the nightly integration run keeps 16 covered for installs
that bring their own database.
This commit is contained in:
Marc-André Bombeck committed 2026-10-25 11:18:14 +01:00
1 parent 6b3c1cc433
commit d4d91994e8
11 files changed
+445 -24

No files matched your search

+4 -3
View File
@@ -44,10 +44,11 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const PROJECT_ROOT = resolve(__dirname, "..", "..");
// The compose file ships Postgres 16; INTEGRATION_PG_IMAGE runs the same
// suite against another major (the TrueNAS app defaults to 18).
// The compose file ships Postgres 18; INTEGRATION_PG_IMAGE runs the same
// suite against another major. The nightly run uses it for Postgres 16, the
// oldest major a self-host on its own database may still run.
const POSTGRES_IMAGE =
process.env.INTEGRATION_PG_IMAGE?.trim() || "postgres:16-alpine";
process.env.INTEGRATION_PG_IMAGE?.trim() || "postgres:18-alpine";
let started: StartedPostgreSqlContainer | null = null;