Improvements to farm_migrate_role migration config.

These changes help to support custom/contrib modules that want
to provide their own role migrations.

- Use skip_map_on_empty process plugin to ensure that skipped rows are not added to the map tables.
- Set a "role" pseudo-field, which is used by role ID matching.
- Move role ID matching process to farm_migrate_role migration group shared config.
- Move farm_migrate_role migration to optional config, dependent on farm_role_roles module.
This commit is contained in:
Michael Stenta 2021-03-18 14:52:47 -04:00
parent 7c16a8db46
commit 1de7f4ed77
2 changed files with 30 additions and 17 deletions

View File

@ -9,4 +9,24 @@ label: 'farmOS 1.x Role Migration'
description: 'Migrates roles from farmOS 1.x to farmOS 2.x'
source_type: 'farmOS 1.x'
module: null
shared_configuration: null
shared_configuration:
process:
# This role field is a placeholder, and should be replaced in the specific
# migration process configuration. This makes it easier for custom/contrib
# modules to provide role migrations. See the farm_migrate_user migration
# for an example that can be copied.
role:
- plugin: default_value
default_value: false
id:
-
plugin: get
source: '@role'
-
plugin: entity_lookup
value_key: id
entity_type: user_role
ignore_case: true
-
plugin: skip_map_on_empty
method: row

View File

@ -4,6 +4,7 @@ dependencies:
enforced:
module:
- farm_migrate
- farm_role_roles
id: farm_migrate_role
label: 'Roles'
migration_group: farm_migrate_role
@ -18,22 +19,14 @@ source:
destination:
plugin: 'entity:user_role'
process:
id:
-
plugin: static_map
source: name
map:
Farm Manager: farm_manager
Farm Worker: farm_worker
Farm Viewer: farm_viewer
-
plugin: entity_lookup
value_key: id
entity_type: user_role
ignore_case: true
-
plugin: skip_on_empty
method: row
role:
plugin: static_map
source: name
map:
Farm Manager: farm_manager
Farm Worker: farm_worker
Farm Viewer: farm_viewer
bypass: true
migration_dependencies:
required: { }
optional: { }