Problem/Motivation
In #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted), we decided to not migrate text fields with conflicting text formats. This also means that there are data which is not migrated into the destination site – and it is very visible if your migrated node misses its (imho) most important body field's data.
As a user migrating from Drupal 7 to Drupal 9, I don't expect data loss in regards of core-provided fields.
Proposed resolution
Migrate even those text fields (and the data they store) which have conflicting text processing settings (on their field instance level).
My ideas:
- Migrate text fields conflicting
text_processingsetting as formatter text fields, but map their filter toplain_text.Pros:
- Easy to implement.
- Only the field migrate plugin should be modified.
- The migrated data is still rendered the same as on the Drupal 7 source instance.
- Create separate field storages for text fields with conflicting
text_processingsetting: one for the plain text fields, and one for the formatted ones.Pros:
- Data storage can be closer to Drupal 8|9 standards.
Cons:
- Less likely to be committed to core (ever) – because of unresolvable BC impacts.
- The migrate source plugin should be modified – including also the data.
- I don't (yet) know how, but every
field_namedestination plugin should use a lookup for getting the destination field name.
This issue/patch implement idea 1.
- Drupal 7 source
-

- Drupal 9 destination — HEAD

- Drupal 9 destination — PATCH (THIS ISSUE)

Remaining tasks
Reroll - tagged novice for this
Review
Commit
User interface changes
Nothing.
API changes
Text fields (and the data they store) with conflicting text processing settings are also migrated.
Data model changes
Nothing.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 3213636-27.drupal.patch | 29.95 KB | j_ten_man |
| #20 | DIFF-3213636-20.txt | 1.96 KB | mikelutz |
| #20 | 3213636-20.drupal.patch | 29.95 KB | mikelutz |
Issue fork drupal-3213636
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 #2
huzookaComment #3
huzookaIn order being able to test this change funcionality, I've added two new nodes:
I added these two nodes on a fully functional Drupal 7 instance built from the Drupal 7 migrate source database fixture, and then exported the changes (mostly by relying on #3213633: Improve DX of maintaining migration database fixtures: provide an option for creating per-table database fixtures in DbDumpcommand).
The data of the previously conflicting (and thus completely ignored) text fields with disabled text processing are migrated with the
plain_textfilter format.Comment #5
huzookaComment #6
huzookaLet's ignore the changes made in
tracker_nodetable.Comment #7
wim leersPatch review
The patches here implement idea 1 from the issue summary.
🥳🥳🥳
Committability review
In order to make this more likely to get committed, I think we need to more clearly articulate why we propose this addition/change, which was apparently chosen not to be done in #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted).
We should update the issue summary with information about the rationale in #2842222 and why we now believe a different rationale is appropriate. Looking at the change record at https://www.drupal.org/node/2906468, it seems that the rationale was that either the settings on the D7 site need to be fixed ("option 1") or a custom migration needs to be developed that splits the field into two ("option 2").
We're introducing an option 3 here. I suspect that to avoid BC, we at minimum need to make this behavior opt-in (using the same
$settings['migrate_node_migrate_type_classic'] = FALSE;-style approach that #2746541: Migrate D6 and D7 node revision translations to D8 introduced?).Conclusion
Marking only for the committability aspects!
Comment #8
wim leersOops, I missed the screenshots in #5. Updating the issue summary.
This actually addresses most of my concerns in #7.
Furthermore, I realized that there is in fact no backwards compatibility concern because this issue will not change any existing migrated data, it will ensure that more data gets migrated at all!
Comment #9
wim leersLooks like I forgot to set the correct issue status…
Comment #10
quietone commentedCame to review but unfortunately this needs a reroll. Tagging for a reroll and since it looks like the changes to the fixture are OK I am also tagging novice for the reroll.
I did skim the patch and nothing jumped out at me that was problematic.
Comment #11
huzookaThank you, @quietone!
Comment #12
tvb commented3 merge conflicts:
1) core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
Re-applied delta's from patch to these array elements in method getEntityCounts:
* field_config: +8
* field_storage_config: +4
* node: +2
2) core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php
Conflict with the new method testDatetimeFields, which was added to class MigrateFieldTest after the #6 patch was created.
3) core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
No obvious conflict in hunk, so re-applied modification from patch.
Comment #13
tvb commentedSee previous comment.
Comment #14
tvb commentedClosing brace indented properly in MigrateFieldTest.
Comment #16
tvb commented* Modify count of expected errors for d7_field migration in testDatetimeFields() to match source count (from 5 to 1).
* Modify index in error $messages array accordingly.
* Fixed a typo.
Comment #18
danflanagan8The re-roll looks correct. I examined a diff between #6 and #16, and all the changes make sense to me. Thanks, @tvb! I'm removing the Novice tag since the re-roll is complete.
This still Needs Review though since it wasn't fully reviewed prior to the re-roll.
Comment #19
danflanagan8Adding a related issue #3061681: Provide the ability to map text formats between source and destination. The Problem/Motivation sections are almost identical. Maybe that one could even be closed as a duplicate.
Comment #20
mikelutzReroll
Comment #22
mikelutzBeen sitting thinking about the BC aspects of this. We are changing the field type plugin, which does mean that existing migrations using it will be returning one result today and a different result after this patch. That said, it is an improvement in the sense that we are migrating a more accurate representation of data than we were in the past. In general, I'm fine with this, but there are a couple use cases I would like to have addressed here.
First, the one BC issue that I see is that if someone runs the migration set as far as the d7_field migration, then updates drupal to include this patch, and then continues their migration set by running the d7_field_instance migration, they are going to end up getting a field type that doesn't exist on the destination system. (Because it wasn't created before the patch, but after the patch, d7_field_instance won't skip that row anymore and it's going to try). There needs to be some way to check that the field was actually created before the instance migration tries to create an instance, because we can't guarantee that anymore.
Second I'd like to see some consideration for those that want to use migrate_upgrade or such to export most of their core migrations, but would like to actually do the work to split the text fields into separate new fields. Without actually testing through this, this would seem to require exporting and running the config migrations, finding the content types that had string fields and deleting the new long field instances, and replacing them with a new string field instance with a new machine name, and then updating the content type migrations to use the new field. This may be okay if we can't do much to make it easier, but that leads me to the next issue:
Documentation. This needs a CR for sure, the migration documentation needs to be updated, and we should document recommended steps for an advanced developer that wants export and run the core configuration migrations, but also adjust to properly separate the text fields in D9/10.
I'm setting this back to NW for some sort of consideration of the BC implications of running the instance migration with this patch if the field migration was ran before the patch, along with a CR and a documentation update plan.
Comment #23
mikelutzAlso, it looks like a test needs an update that I missed in my Re-roll
Comment #24
mikelutzComment #27
j_ten_man commentedRe-roll of #20 for latest 10.1.x updates.
Comment #28
mikelutzCHanging the issue title here for clarity, as failing to migrate something is not data loss. The data remains right where it's supposed to be.
Comment #34
fjgarlin commentedThe patch was no longer applying so I created a MR based on it that would apply. I'm not sure if it should go back to Needs Review after #22
Comment #35
quietone commentedThe Migrate Drupal Module was approved for removal in #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3522602: [meta] Tasks to remove Migrate Drupal module and the removal work in #3522602: [meta] Tasks to remove Migrate Drupal module.
Migrate Drupal will not be moved to a contributed project. It will be removed from core after the Drupal 12.x branch is open.
Comment #36
quietone commentedThe Migrate Drupal and Migrate Drupal UI modules are deprecated and will be removed from Drupal 12. For these modules, effort is now focused on bug fixes and necessary tasks. Therefore, this feature request is closed as won't fix.
Thanks to all for working on this!