When using sql migrate, it's possible the source db is down and cannot be reached, this will cause exception to be thrown in Migrate class constructor, the exception has to be catched, the question is what then? I tried to set $this->enabled = false, but this doesn't prevent further processing of this broken class' instances, which causes further errors inside migration.inc's line 605 and 623 because there is no source or map in the class instance.

Comments

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry it took so long to get back to this one, somehow I missed it...

How would you like this situation to be handled? It seems to me if the source database is down, there's not much that can be done anyway, the best thing is to just let the exception abort the run.

jrao’s picture

Status: Postponed (maintainer needs more info) » Active

It's been a long time, so I don't remember this clearly, but I think the issue is not about exception when the migration is run, but the exception when the migration class is constructed, this will happen when migration is displayed in the list without even running it.

Currently I just catch the exception in the constructor and pass in an dummy map to $this->map, all we need is to let the migration listing be displayed without exception and have a marker on the migration in trouble.

mikeryan’s picture

Issue tags: +Migrate 2.4

OK, sounds reasonable - I think the main thing is to make sure the count methods respect enabled being FALSE.

mikeryan’s picture

Status: Active » Fixed

OK, now catching exceptions cleanly in the various Migration count methods, committed to D6 and D7.

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