Do not attempt to migrate Drupal 7 field instances for fields whose storage was not migrated

Created on 13 April 2023, about 2 years ago

Problem/Motivation

The d7_field_instance migration does not have a mechanism to skip migrating field instances for fields whose storage was not migrated by d7_field. Both d7_field_instance_widget_settings and d7_field_formatter_settings have this check at the start of their process section.

process:
  # We skip field types that don't exist because they weren't migrated by the
  # field migration.
  field_type_exists:
    -
      plugin: migration_lookup
      migration: d7_field
      source:
        - field_name
        - entity_type
    -
      plugin: extract
      index:
        - 0
    -
      plugin: skip_on_empty
      method: row

A similar check is present is also present for Drupal 6 migrations including d6_field_instance, d6_field_formatter_settings, and d6_field_instance_widget_settings to not migrate fields that were not migrated by d6_field.

Having this check in d7_field_instance would be useful to avoid errors that are thrown for attempting to migrate the field instance configuration of a field that does not exist.

Steps to reproduce

  1. In a Drupal 7 site, have a url field attached to the article content type.
  2. In a Drupal 10 site, with no contrib modules installed, run an automated upgrade provided by `migrate_drupal` either from the UI with the help for the `migrate_drupal_ui` modules.
  3. See the recent log messages report where there are errors about trying to migrate the instance of a field type url which does not exist.

For the record, the migrate_url2link module provides an upgrade path from D7 url field to D10 link field, but that is outside the scope of this feature request.

Proposed resolution

Add the same check from d7_field_formatter_settings and d7_field_instance_widget_settings to d7_field_instance.

Remaining tasks

  • Create patch.
  • Write tests.

User interface changes

None.

API changes

Not sure if the migration plugin is a public API.

Data model changes

None.

Release notes snippet

None.

Feature request
Status

Active

Version

10.1

Component
Migration 

Last updated about 14 hours ago

Created by

🇳🇮Nicaragua dinarcon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024