2
votes

I try to migrate drupal 7 site to version 8 following this steps https://www.drupal.org/docs/8/upgrade/upgrading-from-drupal-6-or-7-to-drupal-8. But when migrate the fields of content types I get error of this type in fields that reference other content types "Attempt to create a [field_name] with no type.". "upgrade_d7_field" is the migration id I execute. I'm doing the migration via drush.

I know the posible problem, but I dont know how to resolve. In drupal 7 the type of fields that reference other content types is the "Node reference" type, but in version 8 that type doesn't exist anymore, now is of type "entity reference".

I think that I should change some configurations in my migration definition but I don't know exactly what.

This is migration definition of the migration id "upgrade_d7_field":

uuid: 2edaccb2-22a6-4482-895f-439bbbc66f1a
langcode: es
status: true
dependencies: {  }
id: upgrade_d7_field
class: Drupal\migrate_drupal\Plugin\migrate\FieldMigration
field_plugin_method: alterFieldMigration
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Configuration
migration_group: migrate_drupal_7
label: 'Field configuration'
source:
  plugin: d7_field
  constants:
    status: true
    langcode: und
process:
  entity_type:
    -
      plugin: get
      source: entity_type
  status:
    -
      plugin: get
      source: constants/status
  langcode:
    -
      plugin: get
      source: constants/langcode
  field_name:
    -
      plugin: get
      source: field_name
  type:
    -
      plugin: process_field
      source: type
      method: getFieldType
      map:
        d7_text:
          d7_text: d7_text
        taxonomy_term_reference:
          taxonomy_term_reference: taxonomy_term_reference
        image:
          image: image
        link_field:
          link_field: link_field
        file:
          file: file
        datetime:
          datetime: datetime
        list:
          list: list
  cardinality:
    -
      plugin: get
      source: cardinality
  settings:
    -
      plugin: d7_field_settings
destination:
  plugin: 'entity:field_storage_config'
migration_dependencies:
  required: {  }
  optional: {  }


Seriously I need migrate the data of the D7 site, they are more than 17.000 news with taxonomies, comments and more.

I appreciate any help. Thanks in advance.

2

2 Answers

3
votes

It seems you are using the References module that provides D7 versions of the node_reference and user_reference field types from the old CCK package.

This module was the solution to get these field types enabled in the early days of drupal 7.

Some time later, Entity Reference cames out to d7, it provides a generic field type to reference arbitrary entities and has been included with Drupal 8 core since then.

To address your issue, you should start by migrating the reference fields into the proper field type entity_reference.

There is a module called Reference to EntityReference Field Migration that should help get the job done before your drupal 8 migration.

1
votes

lets assume the d7 field is on a content type called publications and the field is, field_articles_d7 referencing a content type called articles and the new D8 entity reference field is called field_articles_d8 (assume this is on the same content type called publications)also referencing the content type called articles

The sequence should be to

  • Migrate the article content type (migration id : d7_node_article)
  • Then Migrate the publications node type (migration id : d7_node_publication)
    • In the process section you need to do this
      •         field_articles_d8:
                    plugin: migration_lookup
                    migration: d7_node_article
                    source: field_articles_d7
        
        

This is usually the sequential process of migrating a Node reference in Drupal 7 to a Entity Reference in Drupal 8