Problem/Motivation
In line 76 of the "FieldFile" class in "web/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php" the $lookup_result will always result in an empty array, if the migrations are defined using migrate upgrade + migrate tools with the "--configure-only" flag.
This is because $this->migrateLookup->lookup()
does NOT use "An array of migration plugin IDs to look up, or a single ID as a string"(source: method documentation) as the parameter but instead the migration ID, which should be correctly "upgrade_d6_file
" instead of "d6_file
" (current value) when previously generated using drush migrate-upgrade --legacy-db-key=migrate --configure-only
.
This leads to all file fields not having any files attached, when migrated.
Steps to reproduce
- Generate migrations via
drush migrate-upgrade --legacy-db-key=migrate --configure-only
. - Make sure your source db has entity bundles using file fields
- Run
drush migrate-import --group=my_migration_group --continue-on-failure
Proposed resolution
Dynamically use the correct ID of the generated migration file.
Workaround:
See MR:
Change this line:
$lookup_result = $this->migrateLookup->lookup('d6_file', [$value['fid']]);
to
$lookup_result = $this->migrateLookup->lookup('upgrade_d6_file', [$value['fid']]);
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#9 | 3322542-fix-d6-file-field-migration-lookup-MR2977.patch | 937 bytes | Grevil |
Issue fork drupal-3322542
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
Comment #3
AnybodyThanks, @Grevil, I can confirm this issue, still wondering how that can happen.
Might this be related to #2826204: migration using d6_cck_file/d6_field_file process plugin does not work with migration-prefix drush option?
I added an example, how it was fixed in our case, but I guess this static change is wrong and needs to be done dynamically? But I have no clue how to do that correctly, please need help from someone from the core migration team.
Comment #5
AnybodyComment #6
AnybodyComment #7
quietone CreditAttribution: quietone at PreviousNext commentedYes, this is a known problem and there is an existing issue. The suggested fix would break core migrations and any others that use migrate-upgrade. I am closing this as a duplicate.
Fixes welcome over in the original issue and if you want a review, ping me in #migration.
Thanks!
Comment #8
AnybodyThanks, @quietone, sorry I didn't see this relation. That issue is really horrible, I'm sure it cost us days already. Let's proceed there.
Comment #9
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commentedAttached the static patch, if anyone still needs it until #3091841: Remove hardcoded plugin IDs from migration process plugins is fixed.