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
- Remove the process pipeline of the
uuid from bean migration
- 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
Comment #2
gbotis commentedComment #3
huzookaNow I know what is the problem:
The
skip_on_emptyprocess 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.
Comment #4
zenphp commentedGenerated a patch with @gbotis suggestion. This seems to be working well for me.
Comment #5
marc.groth commentedThank 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.
Comment #7
huzookaThis commit in core introduced a special treatment of destination properties with
NULLvalues - 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.
Comment #8
huzookaAdding a test-only patch.
Comment #9
huzookaInstead of removing the
uuidprocess entirely and add it back ifbean_uuidwas installed on the source site, it is a lot easier to remove it ifbean_uuidis disabled.The fix-only patch is the interdiff between #8 and this patch.
Comment #10
huzooka