Problem/Motivation
All node statistics currently migrate under the single migration. It can be derived based on node type.
Proposed resolution
Add a deriver, probably sharing code with D7NodeDeriver, to separate each node type into a different migration.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | interdiff-3226744-22-26.txt | 924 bytes | yash.rode |
| #26 | core-derive_statistics_module_migrations-3226744-26.patch | 8.27 KB | yash.rode |
| #22 | interdiff_15-22.txt | 3.77 KB | narendrar |
| #22 | core-derive_statistics_module_migrations-3226744-22.patch | 8.8 KB | narendrar |
| #17 | interdiff_11-15.txt | 809 bytes | narendrar |
Comments
Comment #2
narendrarHere is the initial patch for review.
Comment #4
narendrarAssigning to self for fixing tests.
Comment #5
narendrarUpdated patch
Comment #7
narendrarComment #8
narendrarComment #9
wim leersLooking great! I basically only have nits:
Could use an
to make it clear we're matching the behavior there.
Let's copy the comment from
\Drupal\node\Plugin\migrate\D7NodeDeriverthat justifies this catching-without-acting-on-it:Interesting pattern!
I don't think anything in Drupal core uses this.
If it's a new
const, it's going to need to be documented.I think that in this case it'd be simpler to just remove the
constand put the string directly in theinnerJoin()parameter?Hm … interesting!
While this is not wrong, I do think this unnecessarily complex: there's nothing wrong with always returning the alias here. That's what all other
@MigrateSourceplugins in Drupal core do! 😊For future reviewers/committers: this is to ensure that the derived migrations get executed.
(Yes, this is weird. But it's pre-existing weirdness in the migration system's test infrastructure, so out of scope here to fix/improve.)
Comment #10
huzookaIf you get the
node_countersource plugin, then you will be able to use its "base" query:$dependency_indexmight be FALSE whenarray_searchdoes not find anything. Before adding the node type derivative ID, you should check that$dependency_indexis not FALSE.Remove this empty line.
If you use 'nc' as alias, then you don't need this condition. (Was mentioned in #9.4.)
Re #9.5:
Actually, that executes all derivative migrations of
statistics_node_translation_counter, and imho it isn't a weirdness. Simply,MigrateTestBase::executeMigration()executes the migration whose (full) ID matches, whileMigrateTestBase::executeMigrations()discovers every (possible) derivatives as well, because it uses$manager->createInstances($id);internally.Comment #11
narendrarThanks for the review Wim & Zoltán. Changes implemented as suggested.
Comment #13
quietone commented@narendraR, thanks for improving the migration system.
Moving to migration system and tagging for an IS update.
Comment #14
wim leersI think @quietone wanted to do this :)
Comment #15
narendrarComment #16
wim leersCan you please also post the interdiff?
Comment #17
narendrarInterdiff added
Issue summary updated
Comment #18
wim leersNo more remarks. Thoroughly tested, works great! 👍
Comment #19
quietone commentedWell, by the standard benchmark that we only add what is needed for the core migrations one we could argue that this is not needed in core. However, there is a migrate meeting tomorrow at a time when I can attend. I will ask there.
This is minor. Instead of 'gathers up' use 'discovered'.
Seeing the change in getIds got me thinking about the effect of this on existing sites. When this patch is applied any existing statistics_node_counter (not configured) will still run but the results will go to new tables. That means there will be a map/message pair of tables that are no longer accessible via drush. We should probably mention that in a CR.
Comment #20
wim leersComment #21
quietone commentedI didn't make it to the migrate meeting in time but I did check with the other maintainers. Not surprising, mikelutz was quite clear that this is not needed in core (where the core migrations support the 1 click UI upgrade system), that it is not solving any known bug in core and adds complication.
Like him, I recall the decision being made that adding derivers would be done in contrib, probably migrate_upgrade. That would make this a won't fix.
Setting to NR to allow for comments.
Comment #22
narendrarUpdated code to avoid circular dependency.
Comment #23
danflanagan8That was from @quietone about 2 months ago. Is it time to close this?
Comment #25
mikelutzYes, it need to be closed and opened as an issue in migrate upgrade. It poses no benefits to core migrate.
Comment #26
yash.rode commentedfix to avoid unnecessary derivatives.