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.
Problem/Motivation
Migrated fields are not removed when the migration is rolled back.
Proposed resolution
The rollback()
function of the Entity
class cannot handle the multi-field $destination_identifier
provided by the field migration destination plugin.
Remaining tasks
Add a rollback()
function to the EntityFieldStorageConfig
class.
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#5 | field_migration_rollback_fails-2706947-5-complete.patch | 3.02 KB | jofitz |
#5 | field_migration_rollback_fails-2706947-5-tests.patch | 2.35 KB | jofitz |
Comments
Comment #2
jofitz CreditAttribution: jofitz at ComputerMinds commentedComment #3
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdd a
rollback()
function to theEntityFieldStorageConfig
class.Comment #4
mikeryanLet's have a test-only patch demonstrating the failure.
Looking more carefully, I'm not sure why we're using a multi-column destination key here in the first place (array('node', 'field_foo')) rather than using the ID as it's understood by the entity system ('node.field_foo'). I.e., couldn't we implement getEntityId() like EntityBaseFieldOverride does, instead of getIds()? EntityConfigBase::import() would need some adjustment, but ultimately I think the whole thing will be simpler (including not having overridden rollback() implementations).
Comment #5
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdd a test to demonstrate the failure.
Comment #8
mikeryanTested locally on 8.2.x, works fine, patch looks good!
Comment #9
alexpottCommitted and pushed 65898a5 to 8.3.x and 1c4857d to 8.2.x and 6a1e3fd to 8.1.x. Thanks!