discourse/migrations/lib/database
Jarek Radosz 0092d481f3
DEV: Handle running TemporaryDb as root (#38988)
PostgreSQL refuses to run initdb/pg_ctl as root. When TemporaryDb
detects it is running as root, it now delegates all PG commands to
the postgres system user via sudo. This fixes the migration-tests
CI workflow where the schema validation step runs as root.

Also adds a PATH-based fallback for pg_bin_path discovery to support
distributions that install PG binaries outside the hardcoded paths
(e.g. Fedora system packages in /usr/bin).

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2026-03-31 20:17:50 +02:00
..
adapter MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
intermediate_db DEV: Handle running TemporaryDb as root (#38988) 2026-03-31 20:17:50 +02:00
schema MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
connection.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
intermediate_db.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
migrator.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
offline_connection.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
prepared_statement_cache.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
schema.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00