Ticket #1135 (closed defect: invalid)
Running backwards migrations when forwards migrations fail is not useful
|Reported by:||klaas@…||Owned by:||andrew|
Whenever south encounters an exception in the forward migration it tries to run the backward migration. (I suppose South doesn't do this when it can use transactions to do the reverting)
I think this is a mistake, for the following reasons:
- Generally the fact that an error has occurred means the forward migration was not complete. So the state that is required for the backwards migration is not there yet. So in general the backwards migration will fail as well.
- This is surely the case when multiple things are done in a single migration, e.g. add a column and directly add a unique index on it.
- Many migrations don't have a backwards migration at all, either out of calculated laziness, or because one cannot exist.
This has the following detrimental effects:
- The original error message when failing to migrate forward is occluded by the error that occurs when trying to revert.
- It's hard to determine the state of the DB after 2 failed migrations (one of which failed at an unknown point due to the above).
See the below for someone else running into this: