Migrate Upgrade results in missing dependencies when running node_complete migrations

Created on 5 April 2024, over 1 year ago

Problem/Motivation

Doing a "simple" D7 migration to D10, when it gets to the point of running the node_complete migrations a number of migration dependencies are listed. If the node migration's dependencies are updated to list the renamed versions of these dependencies, it is still stuck on one.

Example:

[error] Migration upgrade_d7_node_complete_album did not meet the requirements. Missing migrations d7_file_plain_source_field:image, d7_file_plain_type:image, d7_file_plain_source_field_config:image, d7_file, d7_file_plain:image:public.

I updated the upgrade_d7_node_complete_album migration like this:

diff --git a/migrate_plus.migration.upgrade_d7_node_complete_album.yml b/migrate_plus.migration.upgrade_d7_node_complete_album.yml
index 4775460..04656e7 100644
--- a/migrate_plus.migration.upgrade_d7_node_complete_album.yml
+++ b/migrate_plus.migration.upgrade_d7_node_complete_album.yml
@@ -120,6 +120,11 @@ migration_dependencies:
     - upgrade_d7_node_type
     - upgrade_d7_file_plain_image_public
   optional:
+    - upgrade_d7_file_plain_source_field_image
+    - upgrade_d7_file_plain_type_image
+    - upgrade_d7_file_plain_source_field_config_image
+    - upgrade_d7_file
+    - upgrade_d7_file_plain_image_public
     - upgrade_d7_field_instance
     - upgrade_d7_comment_field_instance
     - upgrade_d7_metatag_field_node

It then shows this:

[error] Migration upgrade_d7_node_complete_album did not meet the requirements. Missing migrations d7_file_plain:image:public.

It seems like it is not correctly mapping "d7_file_plain:image:public" to "upgrade_d7_file_plain_image_public", so then it also looks for the migrations that it is dependent upon.

Steps to reproduce

Simple D7 site.
Install Media Migration.
Use Migrate Upgrade, drush to create migration configuration.
Run the migration.

Proposed resolution

Fix the logic to ensure it can correctly identify that "upgrade_d7_file_plain_image_public" replaces "d7_file_plain:image:public".

Remaining tasks

Work out the source of the bug.
Fix it.

API changes

TBD

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States damienmckenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @damienmckenna
  • πŸ‡ΊπŸ‡ΈUnited States damienmckenna NH, USA

    FYI these are the contrib modules I've installed which have migration plugins:

    • entity_access_password
    • fivestar
    • isfield
    • media_migration
    • metatag
    • migmag
    • migrate_plus
    • migrate_tools
    • migrate_upgrade
    • pathauto
    • redirect
    • smart_sql_idmap
    • votingapi
    • webform_migrate
  • πŸ‡ΊπŸ‡ΈUnited States kerasai

    I've come across this now on multiple instances. I've poked at it some, but am unable to determine the root cause. Adjusting the migration's dependencies in the YML doesn't seem to help.

    Here's the error:

    [error] Migration upgrade_d7_node_complete_webform did not meet the requirements. Missing migrations d7_file_plain_source_field:image, d7_file_plain_type:image, d7_file_plain_source_field_config:image, d7_file, d7_file_plain:image:public.

    And that migration's dependencies:

    migration_dependencies:
      required:
        - upgrade_d7_user
        - upgrade_d7_node_type
        - upgrade_d7_file_plain_image_public
      optional:
        - upgrade_d7_field_instance
    

    I worked around it with a solution similar to #3194361-3: [migrate_upgrade] Migrate Upgrade, Migrate Tools and Migrate Commerce leads to dependency failure on media types β†’ .

    Also, I'm confident that

  • πŸ‡ΊπŸ‡ΈUnited States damienmckenna NH, USA

    The issue seems to stem from MediaWysiwygPluginBase::appendProcessor() where it runs the following logic:

          if (!empty(SourceDatabase::getFormatsUsingTag($source_connection, 'img', $field_name_in_source, $source_entity_type))) {
            $extra_processes[] = ['plugin' => 'img_tag_to_embed'];
    
            if (!$file_link_deps_added) {
              $migrations[$migration_id]['migration_dependencies']['required'] = array_unique(
                array_merge(
                  array_values($migrations[$migration_id]['migration_dependencies']['required'] ?? []),
                  [
                    'd7_file_plain:image:public',
                    'd7_file_entity:image:public',
                  ]
                )
              );
            }
          }
    

    When you have the "img_tag_to_embed" process plugin running on your text field it will list these two plugins as dependencies, and then fail. If you comment out the lines above the migration works correctly.

    So maybe we need a global configuration (or something) to disable this dependency check when not needed?

Production build 0.71.5 2024