I'm thinking the issue may be related to #2653984: Drupal 6 term references not migrated but for me the taxonomy term reference field doesn't ever get created. (D6 to D8 Migration) Here is my migrate_plus.migration.upgrade_d6_field_instance.yml:

uuid: 6e1fd6ac-1ec4-4631-93d1-753068fdc667
langcode: en
status: true
dependencies: {  }
id: upgrade_d6_field_instance
migration_tags:
  - 'Drupal 6'
migration_group: migrate_drupal_6
label: 'Field instance configuration'
source:
  plugin: d6_field_instance
  constants:
    entity_type: node
process:
  field_type_exists:
    -
      plugin: migration
      migration: upgrade_d6_field
      source:
        - field_name
    -
      plugin: extract
      index:
        - 1
    -
      plugin: skip_on_empty
      method: row
  entity_type: constants/entity_type
  field_name: field_name
  bundle:
    -
      plugin: migration
      migration: upgrade_d6_node_type
      source: type_name
    -
      plugin: skip_on_empty
      method: row
  label: label
  description: description
  required: required
  status: active
  settings:
    plugin: d6_field_field_settings
    source:
      - widget_type
      - widget_settings
      - global_settings
  default_value_callback: ''
  default_value:
    plugin: d6_field_instance_defaults
    source:
      - widget_type
      - widget_settings
destination:
  plugin: 'entity:field_config'
migration_dependencies:
  required:
    - upgrade_d6_node_type
    - upgrade_d6_field
  optional:
    - upgrade_d6_field
    - upgrade_d6_node_type

Comments

albertski created an issue. See original summary.

albertski’s picture

I am trying to debug this and seeing it goes through the MigrateSkipRowException for the first field which is the taxonomy field. This is my debug message:

Drupal\migrate\MigrateSkipRowException: in /var/www/mysite/web/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php on line 27

albertski’s picture

As a test, I removed the skip on empty from migrate_plus.migration.upgrade_d6_field_instance.yml and tried running the upgrade_d6_field_instance migration and I get the following errors for all the fields that are taxonomy terms:

Attempt to create a field field_agriculture that does not exist on entity type node.                          [error]
(/var/www/mysite/web/core/modules/field/src/Entity/FieldConfig.php:286)
Attempt to create a field field_agriculture that does not exist on entity type node.                          [error]
(/var/www/mysite/web/core/modules/field/src/Entity/FieldConfig.php:286)
albertski’s picture

Okay so now I'm thinking the issues is in upgrade_d6_field. When I run upgrade_d6_field the taxonomy fields don't get created at all.

migrate_plus.migration.upgrade_d6_field.yml

uuid: 719bb94b-de69-4de7-a334-32f6d02c91e2
langcode: en
status: true
dependencies: {  }
_core:
  default_config_hash: WVCFCPXpKquVYQP0Gh4LSIZON17wMCOFimJ9fAXUS_4
id: upgrade_d6_field
migration_tags:
  - 'Drupal 6'
migration_group: migrate_drupal_6
label: 'Field configuration'
source:
  plugin: d6_field
  constants:
    entity_type: node
    langcode: en
process:
  entity_type: constants/entity_type
  status: active
  langcode: constants/langcode
  field_name: field_name
  type:
    plugin: field_type
    source:
      - type
      - widget_type
    map:
      number_integer:
        number: integer
        optionwidgets_select: list_integer
        optionwidgets_buttons: list_integer
        optionwidgets_onoff: boolean
      number_decimal:
        number: decimal
        optionwidgets_select: list_float
        optionwidgets_buttons: list_float
        optionwidgets_onoff: boolean
      number_float:
        number: float
        optionwidgets_select: list_float
        optionwidgets_buttons: list_float
        optionwidgets_onoff: boolean
      email:
        email_textfield: email
      filefield:
        imagefield_widget: image
        filefield_widget: file
      date:
        date_select: datetime
      datestamp:
        date_select: datetime
      datetime:
        date_select: datetime
      fr_phone:
        phone_textfield: telephone
      be_phone:
        phone_textfield: telephone
      it_phone:
        phone_textfield: telephone
      el_phone:
        phone_textfield: telephone
      ch_phone:
        phone_textfield: telephone
      ca_phone:
        phone_textfield: telephone
      cr_phone:
        phone_textfield: telephone
      pa_phone:
        phone_textfield: telephone
      gb_phone:
        phone_textfield: telephone
      ru_phone:
        phone_textfield: telephone
      ua_phone:
        phone_textfield: telephone
      es_phone:
        phone_textfield: telephone
      au_phone:
        phone_textfield: telephone
      cs_phone:
        phone_textfield: telephone
      hu_phone:
        phone_textfield: telephone
      pl_phone:
        phone_textfield: telephone
      nl_phone:
        phone_textfield: telephone
      se_phone:
        phone_textfield: telephone
      za_phone:
        phone_textfield: telephone
      il_phone:
        phone_textfield: telephone
      nz_phone:
        phone_textfield: telephone
      br_phone:
        phone_textfield: telephone
      cl_phone:
        phone_textfield: telephone
      cn_phone:
        phone_textfield: telephone
      hk_phone:
        phone_textfield: telephone
      mo_phone:
        phone_textfield: telephone
      ph_phone:
        phone_textfield: telephone
      sg_phone:
        phone_textfield: telephone
      jo_phone:
        phone_textfield: telephone
      eg_phone:
        phone_textfield: telephone
      pk_phone:
        phone_textfield: telephone
      int_phone:
        phone_textfield: telephone
  cardinality:
    plugin: static_map
    bypass: true
    source: multiple
    map:
      - 1
      - -1
  settings:
    plugin: field_settings
    source:
      - '@type'
      - global_settings
destination:
  plugin: 'entity:field_storage_config'
migration_dependencies:
  required: {  }
  optional: {  }
albertski’s picture

I added the following to process -> type -> map in migrate_plus.migration.upgrade_d6_field.yml and I think the taxonomy fields get created:

      content_taxonomy:
        content_taxonomy_select: entity_reference
        content_taxonomy_autocomplete: entity_reference
        content_taxonomy_hs: entity_reference
      nodereference:
        nodereference_autocomplete: entity_reference
        nodereference_select: entity_reference

Now I am getting errors during upgrade_d6_field_formatter_settings. If I run drush mmsg upgrade_d6_field_formatter_settings I get the following errors:

 37340b866994a1153376805dfe27b95ed69fe6b77c3a41317a094b9c8c8a3154  1       Failed to lookup field type array ( 
                                                                             0 => 'content_taxonomy',          
                                                                             1 => 'default',                   
                                                                           ) in the static map.                
 e73a6d46fe0f5e6d9c29d0573cd6f368037a9ecd42dba6d42b78b7f0d7c0cb78  1       Failed to lookup field type array ( 
                                                                             0 => 'content_taxonomy',          
                                                                             1 => 'default',                   
                                                                           ) in the static map.                
 5efff4ac6fc55d824206e0b2f80446dbd06e99594751319e83181bd81a66aa75  1       Failed to lookup field type array ( 
                                                                             0 => 'content_taxonomy',          
                                                                             1 => 'default',                   
                                                                           ) in the static map.                

albertski’s picture

Fixed the about errors by adding the following to upgrade_d6_field_formatter_settings:

        content_taxonomy:
          default: entity_reference_label
        nodereference:
          default: entity_reference_label
        link:
          default: basic_string
          url: basic_string
        text:
          default: basic_string
          plain: basic_string
        filefield:
          default: file_default
          image_plain: file_default
          slide_thumb_default: file_default
          path_plain: file_default
        location:
          default: basic_string

And this to migrate_plus.migration.upgrade_d6_field_instance_widget_settings.yml:

        content_taxonomy_select: options_select
        nodereference_select: options_select
        content_taxonomy_hs: options_select
        content_taxonomy_autocomplete: entity_reference_autocomplete_tags
        nodereference_autocomplete: entity_reference_autocomplete

I think now everything migrated as far as fields but not seeing taxonomy term data.

albertski’s picture

I noticed that that during the taxonomy revision migrations they would say they were all ignored. I made the following changes to the yml files:

Update from:

process:
  vid:
    -
      plugin: migration
      migration:
        - upgrade_d6_node_importer
        - upgrade_d6_node_news
        - upgrade_d6_node_page
        - upgrade_d6_node_producer
        - upgrade_d6_node_product
      source: vid

To:

process:
  nid:
    -
      plugin: migration
      migration:
        - upgrade_d6_node_importer
        - upgrade_d6_node_news
        - upgrade_d6_node_page
        - upgrade_d6_node_producer
        - upgrade_d6_node_product
      source: nid

It had vid instead of nid. When I made this change It showed it migrated them all but don't see any data in the database tables.

Processed 3453 items (3453 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d6_term_node_12'
Processed 7 items (7 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d6_term_node_7'     
Processed 3297 items (3297 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d6_term_node_revision_12'
Processed 747 items (747 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d6_term_node_revision_7'
albertski’s picture

When I look at the taxonomy entity reference field I noticed that they are set as Content Entity Reference instead of Taxonomy. Perhaps this may be the reason the terms are not coming in now.

albertski’s picture

Actually, #7 is wrong. I think it should be vid (Version id) for revisions.

One thing I did try is to convert the field to a Taxonomy Reference as I mentioned in #8 and then run the upgrade_d6_term_node_7 migration and none of the references get added (table is empty).

In debugging I found that in EntityContentBase::updateEntity:

$field = $entity->$field_name;
if ($field instanceof TypedDataInterface) {
  $field->setValue($values);
}

my $field_name is for example 'regions' and $field is null.

albertski’s picture

I was able to get my terms to migrate by updating the field name inside the term_node_x.yml and term_node_revision_x.yml files to include the field underscore in the name:

Old:

  type: type
  style: tid

New:

  type: type
  field_style: tid

Once I did that everything migrated correctly.

albertski’s picture

Project: Migrate Upgrade » Drupal core
Version: 8.x-3.x-dev » 8.2.x-dev
Component: Code » migration system
Status: Active » Closed (won't fix)

I'm closing this issue because I believe this will be fixed in #2447727: Add base class for migrating reference fields.

At the end of the day if anyone runs into this you can try to follow how I went about it but I was able to go through it by debugging it and updating the yml files.

joey-santiago’s picture

mhm sorry i think i am having a similar problem, haven't understood there you added this field_ you mention in #10.

node_complete.page.yml:

field_software_version:
    -
      plugin: migration_lookup
      migration: upgrade_d7_taxonomy_term_rev

and the term_rev.yml migration:

uuid: 4c372f6d-83d4-4433-a5c2-123299318564
langcode: en
status: true
dependencies: {  }
id: upgrade_d7_taxonomy_term_rev
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Content
migration_group: migrate_drupal_7
label: 'Taxonomy terms (Software version)'
source:
  plugin: d7_taxonomy_term
  bundle: rev
process:
  tid:
    -
      plugin: get
      source: tid
  vid:
    -
      plugin: default_value
      default_value: software_version
  name:
    -
      plugin: get
      source: name
  description/value:
    -
      plugin: get
      source: description
  description/format:
    -
      plugin: get
      source: format
  weight:
    -
      plugin: get
      source: weight
  forum_container:
    -
      plugin: get
      source: is_container
  changed:
    -
      plugin: get
      source: timestamp
  langcode:
    -
      plugin: get
      source: language
  field_public:
    -
      plugin: get
      source: field_public
destination:
  plugin: 'entity:taxonomy_term'
  default_bundle: software_download

I get the terms created, but i don't get any of the terms being used in the nodes that are created in the node_complete.page.yml, even that there should be some.