When I disable my migration module, (or migrate_example), I get multiple "Class * no longer exists" error messages in drush:

$ drush ms --refresh
Class GameBaseball no longer exists                                                                                                 [error]
Class GameBaseball no longer exists                                                                                                 [error]
Class GameBaseball no longer exists                                                                                                 [error]

And so on. Is there a way to get rid of this? I'm using migrate 7.x-2.x from git.

Comments

naught101’s picture

Title: Class no longer exists after migration modle is disabled » "Class no longer exists" after migration module is disabled
naught101’s picture

I should say that I've already tried drush cc all and drush ms --refresh, no change.

messages like
Class D5D7Migration is no longer a valid concrete migration class [error]
(when a migration class has been abstracted) also don't go away.

mikeryan’s picture

Status: Active » Fixed

Your migration module should deregister its migrations in hook_disable() - see migrate_example:

function migrate_example_disable() {
  migrate_example_beer_disable();
  migrate_example_wine_disable();
}

function migrate_example_beer_disable() {
  Migration::deregisterMigration('BeerTerm');
  Migration::deregisterMigration('BeerUser');
  Migration::deregisterMigration('BeerNode');
  Migration::deregisterMigration('BeerComment');
}
naught101’s picture

ok, but this is quite annoying if you're developing Migrations - ie. when they might change names, or change to abstract. I tried
drush ev "Migration::deregisterMigration('BeerTerm');"
but that didn't seem to work..

reecemarsland’s picture

In the latest dev you need
drush ev "MigrationBase::deregisterMigration('NAME');"

Status: Fixed » Closed (fixed)

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

jeff veit’s picture

Suggested solution didn't work for me, but ...

It turned out that for me there were items left in the migrate_status table after uninstalling the example migrate module. (It's also possible that they were added during development when I used one of the example modules as the start point of a migration - so don't treat this as a bug report.)

Anyway, the solution was to go into mysql, and delete the rogue entry...

delete from migrate_status where machine_name="WineProducerXMLPull";

Problem solved.

tmwagner’s picture

Version: 7.x-2.x-dev » 7.x-2.3
Category: support » bug

Confirm suggested solutions don't work. And actually, I would call this a bug.
Thanks for suggestion, Jeff. I was about to start sifting through the DB to find the errant class...

puddyglum’s picture

Status: Closed (fixed) » Active

If I understand this correctly, if you rename/remove a class from your migration you will need to add in a Migration::deregisterMigration('MyOldClass'); for each of them, and then disable and re-enable the module in order to remove the excess tables, records and error messages? Unless I'm mistaken, this seems unnecessarily complicated.

What if the "no longer available" classes were still visible in the UI, but were greyed out and with an option to de-register them... would there be any problem with that?

mikeryan’s picture

Category: bug » support
Status: Active » Closed (fixed)

Please don't reopen closed issues, open a new support request in such cases.

There is now a drush migrate-deregister command:

drush migrate-deregister Article # To deregister a given migration
drush migrate-deregister --orphans # To deregister all migrations whose class no longer exists
Countzero’s picture

The last command in #10 cleared the situation and successfuly deregistered all the stuff.

BTW, the demo module included in migrate_d2d doesn't deregister its classes, which lead me there.

kalyankix’s picture

Seems like this issue still persists. However, the problem can be mitigated, as suggested by @Jeff Veit. You can go ahead and delete the specific class name from the DB Table "migrate_status" for the time being.

patrickfgoddard’s picture

#10 also worked for me. Thank you.

myselfhimself’s picture

#10 drush migrate-deregister --orphans worked for me and I am using migrate_d2d project, thanks mikeryan!

prathK’s picture

Thanks Jeff !!! #7 worked for me. But it is also good idea to De-register the classes which are not in use in .install file in hook_disable() itself. Using #10 drush migrate-deregister is clean way to do the same. :D

Cheers,
PrathK
extrimity.in

jcovington’s picture

Deregistering the errant classes using hook_disable(), was not working for me. I ran the following Drush command, and that appears to have cleaned up the issue.
drush migrate-deregister --orphans

criscom’s picture

drush migrate-deregister --orphans worked for me. Thanks.

themorebeautifulworld’s picture

Issue summary: View changes

#10 drush migrate-deregister --orphans worked for me with a class extending migrate_d2d. Thank you!