Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a migration (products) that uses another migration (images) through the migration process plugin.
There are some images missing, so stub rows with "sample value" file entities are generated.
But the stub rows are not saved to the migration map of image migration. This means that new files are being generated every time the migration runs.
Comment | File | Size | Author |
---|---|---|---|
#10 | migrate-2639144-10-save-stub-in-process-map.patch | 4.71 KB | milesw |
#5 | save_stub_in_process_map-2639144-2.patch | 4.77 KB | miiimooo |
#2 | save_stub_in_process_map-2639144-1.patch | 4.77 KB | miiimooo |
Comments
Comment #2
miiimoooA first shot at fixing this issue.
This patch adds a function processStubRow to MigrationInterface and an implementation to MigrateExecutable that saves the stub's id(s) to the map of the migration used in the process migration plugin. The processing and importing is moved from the Migration process plugin into the MigrateExecutable.
Comment #3
miiimoooComment #5
miiimoooAdd missing return statement.
Comment #6
miiimoooComment #8
milesw CreditAttribution: milesw commentedThis just bit me while migrating a node type that has an entity reference to the same node type. Running the migration would leave a bunch of stubs that were not accounted for in the map table.
Patch #5 seems to work great with 8.0.3, thanks.
Comment #9
milesw CreditAttribution: milesw commentedSome things I'm noticing with migrations that involve stubs:
1. Migration counts are reported wrong. One migration with 434 items reports "Processed 715 items (591 created, 124 updated, 0 failed, 0 ignored)"
2. Rollbacks do not delete all items. The rollback_action in the map table is being set to "preserve" for some items. I believe this is caused by DestinationBase::setRollbackAction().
3. Some chained references are not migrating. Within one migration I have nodes that reference other nodes that in turn reference themselves. This probably isn't supported by Migrate anyway and is not a consequence of the patch.
Comment #10
milesw CreditAttribution: milesw commentedUpdated patch from #5 to return the $destination_ids in MigrateExecutable::processStubRow(). The lack of a return value was the cause of my missing references.
Comment #13
benjy CreditAttribution: benjy at PreviousNext commentedThis is a duplicate of #2682705: Migrate process plugin does not save stubs to the idmap, leads to duplicates and broken references which has a green patch now. @milesw and @miiimooo if you want to comment on that issue you should still get credit.