This module provides a migration plugin that sets a default value for a field, but only if the field doesn't already have a value on the destination entity. This prevents overwriting existing data during migrations.
This module provides a migration processing plugin that will allow you to set a fields default value ONLY if a value does not already exist on the destination node.
One problem we encountered at OHSU was that while we wanted a "default_value" for a particular field, it was aggressively setting that default value if we ever ran a migration with the update flag.
We were unable through searching to determine a way to use core migrate or migrate plus to accomplish this task, and so this module has come to exist.
Usage Use:
Check out the example below. You will place an equivalent in your migrations configuration YML file, for processing a field.
field_prof_provider_type:
plugin: default_if_no_stored_value
default_value: Specialist
entity_type: node
bundle: profileConfiguration Variables:
default_value - The value you wish to assign if no value is present on the destination
entity_type - The entity type you wish to upload. Currently only "node" is supported
bundle - The entity type bundle you wish to load.
Ask your assistant about Migrate Default If No Stored Value
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- migrate Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.