Problem/Motivation
One of the advantages of having migrations stored as templates is that they can be altered to fit the source data before they’re actually run. Before template support was committed, the only way to build dynamic migrations was with load plugins, which are very hard to grok and involved hijacking the Migration entity class and storage handler, which had undesirable side effects in addition to code bloat. Dynamic migrations are also hard to test — as far as I know, there’s no way to run them from the command line.
Proposed Resolution
I want to replace load plugins with builder plugins. They have the same goal — namely, generating migrations dynamically — but whereas load plugins acted at run time, builders run ahead of time, creating a set of migration entities from a template by merging the template with data from the source database. The generated migrations can then be saved, run and exported like any other migration. The main benefits of this are that build plugins are far simpler in every way than load plugins (and they involve less code), and the migrations they generate can be inspected and modified before run-time. Build plugins don’t need to hijack the Migration entity class or storage handler, so #2499173: migrate_drupal highjacks the Migration and MigrationStorage classes will be fixed as a matter of course.
Remaining Tasks
This is a fairly large change, so I think it should be applied in stages.
- Implement the builder plugin type in Migrate, and provide a few builder plugins in Migrate Drupal which replace the current load plugin functionality. Templates which currently use load plugins will also refer to the corresponding builders. Initially, all this will go in alongside the existing load plugin code, in order to prevent the patch from being too big and confusing. #2530030: Create the migrate builder plugin type
- Move absolutely all CCK field handling into dedicated cckfield plugins. There are already two issues for this: #2529144: Create cckfield plugin for text fields and #2528688: Create cckfield plugin for file fields.
- Remove load plugins and their infrastructure, Migrate Drupal’s overridden MigrationStorage and Migration classes, and the special interfaces used for load plugins’ CCK handling. #2549013: Remove load plugins
| Comment | File | Size | Author |
|---|---|---|---|
| migrate_generator.patch | 1.86 KB | phenaproxima |
Comments
Comment #1
phenaproximaRenaming the issue for a funnier commit message.
Comment #2
phenaproximaFixing a typo.
Comment #3
phenaproximaUnblocked. Full steam ahead!
Comment #4
phenaproximaIt's a meta-issue now, mofos.
Comment #5
benjy commentedComment #6
benjy commentedComment #7
phenaproximaComment #8
phenaproximaComment #9
dawehnerTF @title
Comment #10
phenaproximaLoad plugins are gone!
AND THERE WAS MUCH REJOICING. We have forsaken them, as Cthulhu before us. Praise be unto the tentacled one.