Hi, in order to successfully implement a module I am working on, migrate_og, a module to migrate data to Organic Groups, I need to have $tblinfo made available in the delete hook.

The source data has a primary key, but the destination does not. {og_uid} has a set of columns which are UNIQUE.

In order to make the migrate process reversible, an 2 extra columns have been added to the mappings table for that content type. So there are now two three keys in the mappings table. One column contains the duplicate value of the source table, and the two new columns contain the value of the destination keys. The original dest column is duplicated because it needs to be passed to the delete hook.

The delete hook currently only contains the value of the original dest column ($rid). Using the method described above, we can use the $rid to do a lookup on the mappings table, and find the values of the two destination keys. But in order to do this, I need to know the table name for the mappings table.

Other than the reasoning above, I don't see a reason why we shouldn't include $tblinfo, for consistency with the import hook.

Attached is a patch that:

* has logic to create $tblinfo
* modifies the delete invoke hook to add $tblinfo
* adds the $tblinfo parameter to each delete hook included with Migrate.

The patch was tested against Migrate 1.0.

If approved, a sister patch for Migrate Extras can be developed.

CommentFileSizeAuthor
migrate_delete_01.patch4.57 KBdpi

Comments

mikeryan’s picture

Category: bug » feature
mikeryan’s picture

Status: Active » Needs review
mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)
Issue tags: -og migrate

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