Attached is a simple patch to includes/migrate/plugins/destinations/og_membership.inc that adds a rollback function so that you can rollback membership imports from the migrate module. I've tested it using a couple different OG migrations.

CommentFileSizeAuthor
og_membership.patch840 bytessmichel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Status: Active » Needs review

Yes, this exists in Migrate-extra as-well. What is the use case for this rollback?

smichel’s picture

Status: Needs review » Active

I'm doing some membership migrations separately from node and user migrations, and have some added fields that I'm testing (and og roles). I use migrate-import to bring the memberships in, then migrate-rollback to get rid of them. The memberships are deleted of course when users and nodes are deleted, but being able to roll back individual migrations is essential.

amitaibu’s picture

Status: Active » Needs review

Correct status.

+++ b/includes/migrate/plugins/destinations/og_membership.incundefined
@@ -25,6 +25,20 @@ class MigrateDestinationOGMembership extends MigrateDestination {
+    migrate_instrument_start('OGMembership Rollback');

btw, Do we really need this -- isn't it just for timing actions?

smichel’s picture

Status: Needs review » Active

Could be that migrate_instrument_start & _stop aren't needed. Besides timing, it monitors memory consumption, it looks like. I know memory monitoring has been enormously useful to me in large migrations; I don't recall seeing it used on rollbacks.

amitaibu’s picture

Status: Active » Needs review

Please keep the status as is.

smichel’s picture

Sorry, didn't mean to change the status.

amitaibu’s picture

Category: bug » feature
Status: Needs review » Fixed

> I don't recall seeing it used on rollbacks.

Me as-well. I've removed it and committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.