4

My question is a general one: how do you get new migrations, which you've created via a custom module using Migrate, to show up in the Migrate UI at /admin/content/migrate ? What lines of code are necessary in your custom module for this?

Specifically, I'd like to know what's missing from a particular custom module (called ea_hub_migrations.module) that I've created. I created this by cutting down the migrate_example module, but after enabling ea_hub_migrations.module the migration group it defines isn't showing at /admin/content/migrate . By contrast, the migration I created with the module at https://drupal.org/node/1285276 does show up there. Here is the code for my custom module - I'd be very grateful if someone could take a look and tell me what's missing:

ea_hub_migrations.migrate.inc (included via ea_hub_migrations.info) - http://pastebin.com/KWMHd3gx

2
  • The code you linked to still has the hook "migrate_example_migrate_api". Is your module called "migrate_example" ?
    – 2pha
    Nov 16 '14 at 11:10
  • @2pha, thanks I've fixed that, but still have the same issue after disabling and enabling the module and clearing my cache.
    – reconwa
    Nov 16 '14 at 15:07
3

First, the function *_migrate_api() in *.migrate.inc should include the $api with the key api of 2, and the key migrations of the array for your migration.

If you have newly added your migration, drastically changing the code etc, you perhaps need to make Drupal recognise the hook you have just created in your migration module; a guaranteed way for that is to disable once and (re)enable your migration module.

Then you need register your migration. If you use Drush,

drush migrate-register --group=YourMigrationGroupName

would do a job. After Flusing all caches (drush cc all etc), you will see the migration in your migration UI (hopefully!).

I am not an expert, but the above is based on my recent experiences.

2
  • Thanks, that fixed it (though I'm now getting "Processed 0 (0 created, 0 updated)", despite the fact that it imported many rows when I had it enabled earlier on my local site).
    – reconwa
    Nov 17 '14 at 9:07
  • 1
    For me, drush migrate-register did the trick. Thanks
    – Piyin
    Jul 18 '17 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.