Module: Pgbus::Generators::MigrationPath

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: task. When neither applies, everything falls back to 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.