-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report: RenameField and RenameModel operations don't work #51
Comments
Thanks for your report @ThomasAitken! There are effectively serialization issues with There's is effectively a off-by-one error in the questioning logic as well. I wonder if something changed on the Django side though as I'm surprised this also was broken. |
@ThomasAitken #54 should be addressing both of your rename related issues. LMK if it resolves them. As for the the pre-deploy migrations can always be run on their own I'd be curious to see it discussed in a different thread as I believe there might be soundness issues with that? There has been some improvements on this front though in 30b348b |
Solved by #54. |
Regarding soundness issues with allowing pre-deploy migrations to run on their own, there are definitely some possible issues of this kind. For example, suppose Migration 1 contains a single My current implementation (which suffers the above issue) builds the altered dependency graph as follows:
I used "leaves" plural for the second condition because this new proposal does give rise to the possibility of two leaves in a single app (a pre-deploy leaf and a post-deploy leaf), but I have made a slight adjustment to the As indicated, this implementation fails in the above scenario I described. I think the solution would be to alter the first condition in the above proposal as follows:
I think this would not be a typical scenario so it would still be worthwhile to create separate pre- and post-deploy life cycles. With that said, I'm not sure how trivial it will be to implement this amendment. I have not created a discussion thread because this is still in the experimental phase. But that was my thought dump. |
First of all, thank you again for this library, and thank you for your recent changes to support MySQL. A follow up on my earlier issue is that I ended up creating a version of this where I alter Django's default dependency graph so that pre-deploy migrations can always be run on their own, even if out of sequence. I am not planning to submit a pull request for this, although please let me know if you are interested in this concept and I can explain more (it relies on the concept that a pre-deploy migration need never actually rely on a post-deploy migration).
Anyhow, this issue is a bug report
First bug
This is a bug that causes migrations containing RenameField and (I suspect) RenameModel operations to fail completely.
Steps to reproduce:
makemigrations
Now try to plan/run the newly generated migration using
python manage.py migrate
. You get an error trace like this:Commentary
Line 120 in
autodetector.py
is meant to prevent this:operation = RenameField.for_stage(operation, stage)
by re-initialising the operation class with the appropriate stageBut the generated migration uses a new instance of this class, so this line does nothing.
Second Bug
The questioner flow uses 0-based indexing for the choices but it should be 1-based indexing because they're displayed as
1, 2, 3, 4
.Apologies if I somehow misunderstood something with regard to either of these two bugs
The text was updated successfully, but these errors were encountered: