0

I am migrating content with paragraph fields.

My paragraph migration.

langcode: en
status: true
id: my_paragraph_import
label: Paragraph import
migration_tags:
  - paragraph
  - my_paragraph_import
source:
  plugin: contact_person_csv
  delimiter: ','
  enclosure: '"'
  escape: '`'
  header_offset: 0
  ids: ['personal']
destination:
  plugin: 'entity_reference_revisions:paragraph'
  default_bundle: organisation_member
process:
  mail:
    - plugin: skip_on_empty
      method: process
      source: 'e-mail werk'
  cellphone:
    - plugin: skip_on_empty
      method: process
      source: 'gsm werk'
  phone:
    - plugin: skip_on_empty
  method: process
  source: telefoon
dependencies:
  enforced:
    module:
      - migrate_source_csv

My content migration:

langcode: en
status: true
id: contact_person_import
label: Contact persons
migration_tags:
  - node
  - contact_person_import
source:
  plugin: contact_person_csv
  delimiter: ','
  enclosure: '"'
  escape: '`'
  header_offset: 0
  ids: ['personal']
destination:
  plugin: 'entity:node'
  default_bundle: contact
process:
  type:
    plugin: default_value
    default_value: contact
  title: title
  first_name: 'first name'
  last_name: 'last name'
  my_paragraph:
    - plugin: migration_lookup
      migration: my_paragraph_import
      source: personal
  paragraph_field:
    - plugin: sub_process
      source:
        - '@my_paragraph'
      process:
        target_id: '0'
        target_revision_id: '1'
dependencies:
  enforced:
    module:
      - migrate_source_csv

I executed the migration. The migration works fine. The nodes with paragraphs are migrated.

In the paragraph, I have another field Function, which I did not map in the migration.

After the content migrated, I updated one node and filled in the Function field in the paragraph.

Then I executed the migration again, then when I edited that node again, The value from the Function field has been removed.

While the other fields of the node preserved the values but not in the paragraph.

Is there any way to preserve the paragraph field values after re-migration?

4
  • It has not been removed, it has been set to whatever value your migration provides. If your migration provides NULL, the value will be set to null. How should your migration know, when it should insert a value, and when it should update a value? Don't include it in the migration, if you don't want to update OR simply don't rerun the migration. I've been down this road, you'll hurt yourself if you violate the Single source of truth (In this case truth means "is allowed to update" instead of "by reference")
    – Hudri
    Mar 15, 2021 at 9:12
  • There is an overwrite_properties for migration, but when I tried to use this with paragraphs, it did not work as expected for me.
    – Hudri
    Mar 15, 2021 at 9:25
  • @Hudri that specific field is not mapped in the migration file.
    – Ahmad
    Mar 15, 2021 at 9:56
  • in the overwirite_properties, I will mention those fields which need to be updated?
    – Ahmad
    Mar 15, 2021 at 10:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.