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
Comment #1
mikeryanSorry 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.
Comment #2
jrao commentedIt'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.
Comment #3
mikeryanOK, sounds reasonable - I think the main thing is to make sure the count methods respect enabled being FALSE.
Comment #4
mikeryanOK, now catching exceptions cleanly in the various Migration count methods, committed to D6 and D7.