Currently only creation and update are supported.
It can be useful to have a way to delete previously migrated data.

Comments

mpp created an issue. See original summary.

mikeryan’s picture

That's a bit... vague. I'm guessing you mean deleting migrated data when the source data is no longer present? That's a lot harder than you may be imagining - see the D7 discussion at #1416672: Optionally delete destination when source data is removed (with tests).

mpp’s picture

Hey Mike, thanks for your feedback.

I'm already following that issue and I thought I had linked it here.. bizarre. Anyhow, thanks for linking it!

Atm, the only solutions I can come up with is adding a flag with the publication status and then performing a migrate --update which will not actually delete data OR a implement a POST_ROW_SAVE event to manually delete data which just seems wrong..

chx’s picture

I will not decide whether this should or should not be done but if the decision is positive then it should be implemented like this: add a delete_property to the destination plugin configuration and if that property is true-ish then execute a delete. So:

process:
  needs_to_be_deleted:
    plugin: static_map
    source: status
    map:
      1: 0
      0: 1
destination:
  delete_property: needs_to_be_deleted

This is easy to implement and aligns with the whole system: much like constants are not a fixed property name to avoid clashes with existing property names, this is also not fixed to anything (like delete or somesuch) but is configurable. All the logic is still in process where it belongs. And everything is explicit and manual. Whether or not highwater should be adjusted in case of a delete can be another option.

mpp’s picture

Hi chx, that looks much better indeed! Is there a place where I can get some more information on the highwater property?

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

geerlingguy’s picture

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture