Module: Pgbus::Generators::MigrationPath
- Included in:
- AddFailedEventsIndexGenerator, AddJobStatsGenerator, AddJobStatsLatencyGenerator, AddJobStatsQueueIndexGenerator, AddOutboxGenerator, AddPresenceGenerator, AddQueueStatesGenerator, AddRecurringGenerator, AddStreamQueuesGenerator, AddStreamStatsGenerator, AddUniquenessKeysGenerator, InstallGenerator, MigrateJobLocksGenerator, TuneAutovacuumGenerator, TuneFillfactorGenerator, UpgradePgmqGenerator
- Defined in:
- lib/generators/pgbus/migration_path.rb
Overview
Shared migration path logic for all pgbus generators.
A separate pgbus database can be selected two ways:
1. --database=pgbus explicitly on the generator invocation, or
2. the host app has already configured Pgbus with a dedicated database
(config.connects_to = { database: { writing: :pgbus } }).
When either applies, migrations go to the separate-database path (e.g.
db/pgbus_migrate) and the post-install output names the db:migrate:
Auto-detecting from connects_to (case 2) fixes issue #344: a bare
rails g pgbus:add_* in an app configured for a separate database used to
silently write to db/migrate and run against the WRONG database.