I'm writing some migrations using the Migrate module. I need to set up redirects after I migrate in an item, but I'm not sure where to perform that action.
I can do it in the complete() function for the migration, which is called after each object has successfully been inserted. At that point, I'd have enough information to programmatically add a redirect.
However, if I needed to roll back the migration, I don't see where I can put in any clean up code to remove those redirects. There are pre and post rollback functions, but those are called before the entire migration is rolled back.
I suppose one alternative would be to, in a pre rollback, query the map table for all the objects and then lookup and destroy the redirects like that. Seems ugly.
I think the best solution here is to have a pre/post rollback function available on a per-object basis.
Anyone run into this previously or have suggestions?