Problem/Motivation

When migrate_default_content generates migration plugin definitions, it can overwrite properties from an existing custom migration YAML definition with the same migration ID.

This means custom properties such as migration_group can be lost, causing generated default-content migrations to appear under the implicit Default (default) group instead of the group explicitly set by the site.

Proposed resolution

Pass the existing migration plugin definitions into MigrationGenerator::generateMigrations().

When a generated migration has a matching existing plugin definition, merge the existing custom definition back over the generated definition using array_replace_recursive(). This preserves generated defaults while allowing explicit YAML properties, such as migration_group, to override them.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review

Added a test to show the fix actually fixes things.

AI-Generated: Yes (AI was used to help draft, review, and refine this issue and MR, including the test. I edited and omitted parts of the generation, and steered the test into the shape it is, I installed ddev-drupal-contrib locally to run tests locally before submitting them, and manually tested with my real-world problem)

joelpittet’s picture

The YAML in the test started as a separate file, but I inlined it because I was afraid of loading paths in gitlab-ci, if that is a concern I am happy to refine and bring back the actual YAML file as a fixture... or ditch the test if you don't want tests here (this would be the first for the module)...