fix(dev): pre-create pg extensions + grant CREATE-on-db for fresh split-role volume #251
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/dev-pg-preinstall-extensions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
On a fresh Postgres data volume the dev stack could not boot. The split-role provisioning (PMS-285) runs both the public-schema and mokosh-auth migration sets as the unprivileged mokosh_migrator role, but two operations in those migrations need privileges a plain BYPASSRLS role lacks. Older dev volumes masked this because their schema + extensions were created earlier by the postgres superuser, pre-split.
Pre-create the four required extensions as the postgres superuser in the entrypoint (uuid-ossp + pg_trgm for the public schema migration 002, citext + pgcrypto for mokosh-auth). They are untrusted, so only a superuser can CREATE them; every migration uses CREATE EXTENSION IF NOT EXISTS so the migration step becomes a no-op. Without this, boot failed at migration 002 with permission denied to create extension "uuid-ossp".
Also GRANT CREATE ON DATABASE to mokosh_migrator so the mokosh-auth bootstrap (which runs as mokosh_migrator via try_bootstrap_sso -> migrator_pool) can CREATE SCHEMA mokosh_auth and own it. Without this, boot failed at mokosh-auth migration 20260506000001 with permission denied for database mokosh.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com