Billing information migration does not work with migrate_upgrade

Created on 21 May 2024, 11 months ago

Problem/Motivation

When using migrate_upgrade to start a migration the order migration will always have an item added for "billing_profile" to the commerce1_order migration which looks like this:

  billing_profile:
    -
      plugin: commerce_migrate_commerce_reference_revision
      migration: commerce1_profile
      source: commerce_customer_billing
      no_stub: true

The first problem is that the "migration" item is not updated to add Migrate Upgrade's prefix, so it never matches records.

The second problem is that if the migration is created using --configure-only and then manually modified, the above process definition is automatically added to the migration again, either overriding the customizations made or in addition to any other changes made.

Instead of dynamically adding the billing_profile items, maybe they should just be added to the base commerce1_order migration definition?

Steps to reproduce

Use migrate upgrade to do a Commerce 1 migration.

Proposed resolution

1. Update the logic that adds the billing_profile process definition to accommodate migrate_upgrade.
2. Don't automatically add the process item after the initial plugin creation process.

Remaining tasks

Work out the beset approach to fix this.

User interface changes

1. The billing_profile migration can work with migrate_upgrade.
2. The process plugin is not added after the initial migration configuration is created.

API changes

TBD

Data model changes

n/a

πŸ› Bug report
Status

Needs review

Version

4.0

Component

Drupal Commerce 1.x

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

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

Comments & Activities

  • Issue created by @DamienMcKenna
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    OTOH I wonder if modifying migrate_upgrade to include "commerce_migrate_commerce_reference_revision" in the list of migrate_lookup -based plugins would help?

    diff --git a/src/MigrateUpgradeDrushRunner.php b/src/MigrateUpgradeDrushRunner.php
    index 33e8344..1738687 100644
    --- a/src/MigrateUpgradeDrushRunner.php
    +++ b/src/MigrateUpgradeDrushRunner.php
    @@ -82,6 +82,7 @@ class MigrateUpgradeDrushRunner {
       protected $migrationLookupPluginIds = [
         'migration',
         'migration_lookup',
    +    'commerce_migrate_commerce_reference_revision',
       ];
     
       /**
    
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    I opened ✨ Extend list of migrate_lookup -like migration plugins Needs review for Migrate Upgrade to cover #2.

  • Status changed to Needs review 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    This fixes the lookups for me, though it could probably be reworked to be cleaner.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    FWIW I also noticed that additional Field API fields which exist on the source are added to the mapping. When I customized the migration I renamed one of the fields from "field_order_notes' to "field_notes" and updated the migration accordingly; while debugging this problem I found that the system created a new migration process called "field_order_notes".

    I think whatever is automatically creating the migration process definitions is being too .. greedy? It should only add the process definitions when the migration definition is first created, it shouldn't constantly add new items.

Production build 0.71.5 2024