Ticket #805 (new defect)
Failure in post_syncdb signal handlers mask failure in migration
|Reported by:||dpisoni@…||Owned by:||andrew|
So in migration.migrators.Forwards.migrate_many() is this code:
# Call any pending post_syncdb signals
I'm a little unclear why this is in a finally block and not just the last call in the try block. If an exception is raised, doesn't that mean that the migration failed and the transaction was rolled-back? If so, why send the post_syncdb signals?
In my case, what is happening is that I have to go mucking around with the debugger to figure out why my migration is failing because the exception I am causing is "lost" when the syncdb handler raises its own exception.
So why is this in a finally block, anyway?
The specifics for my case involve a new model created, data copied from another model to it, then the old model is destroyed. I made an error in the data migration bit, so it raises, but because the transaction is rolled back, the signal goes out, it attempts to remove entries from django_content_type that I'm referring to in another model that is also supposed to be deleted by this migration.