This project is archived and is in readonly mode.
Migration up and down inconsistent
-
Pratik
- State changed from new to invalid
This is expected behavior. You shouldn't migrate back, but generate a new migration dropping contractor table.
Thanks.
-
feldercarb
Unfortunately, by your logic, in order to debug a database construction issue you would have to create a migration that resets your database to the test state and add another migration to get back to the point you need to be. So instead of debugging your problem, you're adding to the issue before you fix the problem.
Look beyond the example that identified the problem and examine the problem instead.
The problem is that if you run one migration at a time and try to revert a migration, the system generates an exception. But if you migrate the entire database at a single time, reverting migrations works properly.
Another example of this would be when you attempt to move your system to a new machine and need to run the migrations but encounter an exception (assume a name you used is now a reserved word or is already in use). Now for proper QA in some organizations (like mine) you need to run each step to isolate the bug and duplicate the bug in front of multiple people. When you do this, the migrations throw exceptions instead of the database throwing the exception which is what you're trying to demonstrate.