Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am migrating roles from D6 to D8 with Migrate. D6 roles are mapped to existing D8 ones, which should not be removed (see my migration below). At rollback, the Pro+ role is removed. Apparently, Migrate uses a rollback_action
which has two possible values, as defined in MigrateIdMapInterface:
/**
* Codes reflecting how to handle the destination item on rollback.
*/
const ROLLBACK_DELETE = 0;
const ROLLBACK_PRESERVE = 1;
I tried to use this key in my YAML file at different levels, to no avail. Could you help me?
id: myproject_d6_user_role
label: 'User roles'
migration_group: myproject_d6
source:
plugin: d6_user_role
process:
id:
-
plugin: static_map
source: name
bypass: false
map:
'Utilisateurs anonymes': 'anonymous'
'Utilisateurs enregistrés': 'authenticated'
'Gestionnaire des utilisateurs': 'redacteur'
'Pro+': 'pro_plus'
'Utilisateurs professionnels': 'pro_plus'
-
plugin: user_update_8002
permissions:
-
plugin: static_map
source: permissions
bypass: true
map:
'post comments without approval': 'skip comment approval'
-
plugin: system_update_7000
-
plugin: node_update_7008
-
plugin: flatten
-
plugin: filter_format_permission
destination:
plugin: 'entity:user_role'
rollback_action: 1
rollback_action: 1
migration_dependencies: { }
Comment | File | Size | Author |
---|---|---|---|
#10 | 2912244-10.patch | 2.38 KB | quietone |
#8 | 2912244-8.patch | 2.24 KB | quietone |
#6 | 2912244-6.patch | 1.56 KB | quietone |
Comments
Comment #2
heddnComment #4
quietone CreditAttribution: quietone as a volunteer commented@heddn, where do you suggest this is documented, DestinationBase?
Comment #5
heddnThat makes sense to mention it in DestinationBase. But since its a constant on MigrateIdMapInterface, we should probably discuss it more there. I sense it is more of an id map thing.
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedChanging to a task.
How about this, which adds a description of each migrate_map property?
Comment #7
heddnI get what we are wanting to communicate here. Where there are N number of source and destination columns. But for the non initiated, I think we could make this even more clear.
We don't really elaborate on these 2 values. Shouldn't we?
Comment #8
quietone CreditAttribution: quietone as a volunteer commented@heddn, thanks.
Changes as suggested. No interdiff because this is so small.
Comment #9
heddnThe status constants we define in-line. The rollback ones we don't. I feel we should keep that in sync and add a couple lines on the rollback ones to help clarify. Alternatively, remove all the status in-line and update their constant docs.
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedI wasn't happy with that section myself. I really don't think the constants should be explained like that in the interface doc block. How about adding documentation for the status constants and simply refer to them in the doc block. And lets expand the scope to 'add documentation' to MigrateIdMapInterface.
What do you think?
edit: s/was/wasn't/
Comment #11
heddnMuch better. Nice good docs!
Comment #12
alexpottCommitted and pushed ff18b59a49 to 9.1.x and 63bb3cbb0b to 9.0.x and 9d7cfefe1e to 8.9.x. Thanks!
Backported to 8.9.x as this is a docs fix.