discourse/migrations
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
..
bin MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
config DEV: Handle running TemporaryDb as root (#38988) 2026-03-31 20:17:50 +02:00
db MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
docs MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
lib DEV: Handle running TemporaryDb as root (#38988) 2026-03-31 20:17:50 +02:00
scripts/benchmarks REFACTOR: Code generator for migrations IntemerdiateDB 2025-04-07 17:22:36 +02:00
spec MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
.gitignore MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
.reek.yml MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
.rubocop.yml DEV: Refactor migrations-tooling 2025-04-07 17:22:36 +02:00
AGENTS.md MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
CLAUDE.md MT: Refactor schema configuration from YAML to Ruby DSL 2026-03-19 18:10:26 +01:00
migrations.rb MT: Switch to nested module style across migrations/ (#38564) 2026-03-19 18:15:19 +01:00
README.md DEV: Add converter framework for migrations-tooling (#28540) 2024-09-09 17:14:39 +02:00

Migrations Tooling

Command line interface

./bin/cli help

Converters

Public converters are stored in lib/converters/. If you need to run a private converter, put its code into a subdirectory of private/converters/

Development

Installing gems

bundle config set --local with migrations
bundle install

Updating gems

bundle update --group migrations

Running tests

You need to execute rspec in the root of the project.

bin/rspec --default-path migrations/spec