Skip to content

Patch ActiveRecord::Generators::Migration#configured_migrated_path to exclude post-migrations path

Douglas Barbosa Alexandre requested to merge da-patch-migration-generator into master

What does this MR do and why?

We can set the migrations_paths in the database configurations to tell Rails where the migrations for the additional database will live when using the --database flag. We use this setting also to include the Geo post-deployment migrations path.

The problem is that the Rails migration generator joins the elements within the array into one path while creating the migration file, which breaks both regular and post-migration for the Geo database because the migration file will be written in the wrong place.

This patch modifies ActiveRecord::Generators::Migration#configured_migrated_path to exclude any post-migration path, and always return only one value while creating a migration file.

For more context:

Related issues

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Douglas Barbosa Alexandre

Merge request reports