How can I fix a migration input format mess?
-
25-02-2021 - |
Question
I did a migration from Drupal 6 to Drupal 8 and now I have two Full HTML, two Plain text, and all other individual for both versions of Drupal default text formats. Of course when I try to modify the duplicates I have warning that it is not possible to have the same human readable names so I have Full HTML and Full HTML2 now. I want to get rid the one of them. It looks like that all the migrated by me content is with a text format with a machine name 2 while the other Full HTML text format with no any content in the website is with the machine name full_html. Also the default Plain Text, the one that it is not possible to be removed is with a machine name 3.
As far as understand by the research I did, even if I disable the full_html text format, I cannot use its machine name for the other one. I don't mind what the name is, but can I safely change somehow the text format machine name 2 to something more meaningful?
Is it necessary to do so, or it will be fine if I leave it this way and just remove the full_html one as far as I do not need it?
Solution
One option is in the migration template, to add the input format value.
I found the default_value
plugin worked well there e.g, to set default full_html
:
field_subheading:
plugin: sub_process
source: field_subheading
process:
value: value
format:
plugin: default_value
default_value: full_html
Another option, could be to run an SQL query to update the field data and revision data tables
update node__field_subheading set field_subheading_format = 'full_html' where field_subheading_format = 'other_format';
update node_revision__field_subheading set field_subheading_format = 'full_html' where field_subheading_format = 'other_format';
then clear cache.
However fixing as part of the migration template mapping is recommended.