I have a need to migrate about 10 tables that are provided by our custom drupal modules.
All of those tables are defined through the Schema API.

Since it's a bit stupid to write a handler for each one of those, changing only the fields, I thought I'd write a generic plugin that takes the table name and figures out the rest. Feels like something that should be in the base Migrate module.

Supports updates. Completely untested.

Comments

bojanz’s picture

Status: Reviewed & tested by the community » Needs review

Also supports compound primary keys, which complicates things a bit, as you can see.

Also, wrong issue status.

bojanz’s picture

StatusFileSize
new4 KB

Better.

bojanz’s picture

StatusFileSize
new5.52 KB

This one should be near-final.

bojanz’s picture

StatusFileSize
new5.52 KB

This is the version we ended up using.
It's only slightly different than #3.

drewish’s picture

Did you have any problems with rollbacks? Working on inserting records into {users_rolls} It seemed to be trying to to delete WHERE (destid1 = 1) AND (destid2 = 2) rather than (uid = 1) and (rid = 2). I'm not sure if it's this class or the rollback code that's passing the wrong keys names in.

bojanz’s picture

Not that I remember. It's really been a while though.

drewish’s picture

It either didn't work or they changed the keys they pass in since you wrote this. We got a fix for it over at #1147366: Migration::rollback() should use the MigrationDestination's field names for keys..

mikeryan’s picture

Category: task » feature
Status: Needs review » Fixed

Finally! I've reviewed and committed this enhancement (with a few tweaks, plus an example and test). I can see, now that I've finally looked, that it should be very handy, thanks!

Status: Fixed » Closed (fixed)

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