Problem/Motivation
\Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
derives the d7_taxonomy_term
migration base plugin definition into one migration plugin definition per vocabulary.
This is great! It makes it easy to see how many terms are migrated per vocabulary, which is valuable. 👍
What's less good, is that every such derived migration also declares an optional dependency on every other one. Even though there is absolutely no interdependency between terms in different vocabularies. For example, when migrating wimleers.com
, I see this:
I suspect this was done for historical reasons, because prior to #2977882: Term entity type's "parent" field does not specify "target_bundles" setting: a term from *any* vocabulary can be chosen, it was in principle possible to link to any Term
entity, regardless of its bundle
. But that was fixed >1 year ago.
Proposed resolution
Remove this optional dependency!
(This allows for greater freedom in which to run migrations. It also is less confusing.)
Remaining tasks
Figure out what is adding this optional dependency. I spent 15 minutes grepping and searching and could not figure it out yet 😑
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#17 | 3097312-17.patch | 2.1 KB | Wim Leers |
#17 | interdiff.txt | 1003 bytes | Wim Leers |
#15 | interdiff_8-15.txt | 1.08 KB | raman.b |
#15 | 3097312-15.patch | 2.1 KB | raman.b |
#8 | 3097312-8.patch | 2.17 KB | quietone |
Comments
Comment #2
Wim LeersTypo 🤦♂️
Comment #4
quietone CreditAttribution: quietone as a volunteer commentedTook a while but this is what I see.
First I noticed that after the migrations are created the migration dependencies on the d7_taxonomy_term is changed from
to
A look at the process pipeline and there is a use of migration_lookup with a migration of d7_taxonomy_term. So, somewhere there is code that thoughtfully looks for dependent migrations in the pipeline and adds it to the optional dependencies. Where? In \Drupal\migrate\Plugin\Migration::findMigrationDependencies.
And looks like we need to make a new issue to remove the use of 'iterator' and 'migration' from findMigrationDependencies because they are deprecated.
Comment #5
quietone CreditAttribution: quietone as a volunteer commentedAnd a patch.
Comment #7
quietone CreditAttribution: quietone as a volunteer commentedFunny, I meant to add the isset().
Comment #8
quietone CreditAttribution: quietone as a volunteer commentedThe change to the test was using the removed process plugin, 'iterator'. This patch removes that usage. Since the test has change there is a new fail patch.
Comment #10
mikelutzI like it. This makes sense. There's no point in adding a dependency on yourself, but this will add the dependencies in still if you are looking up against a different migration, which is good to help order them.
Comment #11
Wim Leers🥳
Comment #12
larowlanI reviewed this with a view to commit it, but I honestly are not qualified to do so, its outside my area of comfort/expertise
I get what is happening in principle, but I'll leave this to someone more familiar with this area of migrate
Comment #13
alexpottThis can be written slightly more concisely as
Comment #15
raman.b CreditAttribution: raman.b at OpenSense Labs commentedAddressing #13
Comment #16
benjifisher@raman.b:
Thanks for updating the patch!
According to Line length and wrapping in the coding standards,
But the patch in #15 does exactly what #13 requested, and I am not going to argue with @alexpott.
I will ask for a couple of changes to the comment:
Comment #17
Wim Leers#16++
Done.
Comment #18
Wim LeersGeneralizing title.
Comment #19
Wim LeersComment #20
quietone CreditAttribution: quietone as a volunteer commentedWant to emphasize the migration_lookup.
Comment #21
quietone CreditAttribution: quietone as a volunteer commentedComment #22
alexpottCommitted and pushed 0e13819245 to 9.2.x and bf40e13e24 to 9.1.x. Thanks!