Problem/Motivation

Migrating bean from D7 without bean_uuid enabled causes SQL error, as 'uuid' value at block_content table is required.

Steps to reproduce

Try to run bean.yml migration without using bean_uuid on legacy d7 site.

For me the following addition at BeanEntityContentComplete.php works:

if(!$entity->uuid()) {
  $uuid = \Drupal::service('uuid')->generate();
  $entity->set('uuid', $uuid);
}

but I cannot test if it creates problem with pre existing uuids

Proposed resolution

  1. Remove the process pipeline of the uuid from bean migration
  2. Add it back if, and only if bean_uuid was installed on the source site:
    • Implement hook_migration_plugins_alter()
    • Check if bean_uuid is installed in the source, and if it is installed
    • Add the current uuid process pipeline back to the migration.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

gbotis created an issue. See original summary.

gbotis’s picture

Issue summary: View changes
huzooka’s picture

Version: 1.0.0-beta2 » 1.0.x-dev
Category: Support request » Bug report

Now I know what is the problem:

The skip_on_empty process plugin works differently than I thought before. It doesn't mark the destination property empty, it just stops the process pipeline.

Will address this bug.

zenphp’s picture

Generated a patch with @gbotis suggestion. This seems to be working well for me.

marc.groth’s picture

Status: Active » Needs review

Thank you so much @zenphp. The patch applies cleanly and the beans are created successfully once applied.

Not sure if one person (myself) is enough to mark as RTBC so feel free to update this if that is the case.

Status: Needs review » Needs work

The last submitted patch, 4: 3205356-add-uuid-generation-when-missing.patch, failed testing. View results

huzooka’s picture

This commit in core introduced a special treatment of destination properties with NULL values - and marks these properties as "empty". Which shouldn't be a problem – but!
The entity destination plugins explicitly set these properties to NULL - which then breaks e.g. the migration path of bean entities 😞
Exactly the same issue I wrote about recently in https://huzooka.github.io/development/2022/05/29/empty-properties-change...

I suggest using a different approach for fixing this.

huzooka’s picture

StatusFileSize
new6.96 KB

Adding a test-only patch.

huzooka’s picture

Status: Needs work » Needs review
StatusFileSize
new1.76 KB
new8.71 KB

Instead of removing the uuid process entirely and add it back if bean_uuid was installed on the source site, it is a lot easier to remove it if bean_uuid is disabled.

The fix-only patch is the interdiff between #8 and this patch.

huzooka’s picture

Status: Needs review » Fixed

  • huzooka committed 4865981 on 1.0.x
    Issue #3205356 by huzooka, zenphp, gbotis: Migrating Bean without UUID...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.