Documentation
¶
Overview ¶
Command muster-migrate applies muster's migrations to the database named by DATABASE_URL and exits.
🔴 IT IS A CI AND DEVELOPMENT FIXTURE, NOT A DEPLOY STEP. The server migrates itself at boot.
It also carries the ROLLBACK for migration 0007 (row-level security), and it ships in the image as /muster-migrate for exactly that:
/muster-migrate --rls-off disable RLS + owner_id DEFAULT 1, so an image
built before accounts PR 3a can run against
this schema (internal/db/rollback/rls_off.sql)
/muster-migrate --rls-on re-apply 0007 (undo --rls-off)
Either flag does ONLY that — no migrations are applied in the same run — and then reads the state back and prints it per owned table, failing if any is wrong. 🔴 Run them from THIS binary (or newer), BEFORE reverting the image: an older /muster-migrate ignores the flag, says "nothing to apply" and exits 0. This exists so the TEMPLATE database that internal/dbtest copies can be migrated ONCE, before the test binaries start — otherwise the first Postgres-backed package to run pays the whole bootstrap under an advisory lock while every other package queues behind it.