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
Fixed #33563 -- Fixed contenttype reverse data migration crash with a multiple databases setup. #15474
Fixed #33563 -- Fixed contenttype reverse data migration crash with a multiple databases setup. #15474
Conversation
Hello @hamstap85! Thank you for your contribution 💪 As it's your first contribution be sure to check out the patch review checklist. If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket! If you have any design or process questions then you can ask in the Django forum. Welcome aboard ⛵️! |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
b4f78e2
to
4a636cd
Compare
I have ensured that the test passes in both parallel and non-parallel mode without corrupting the rest of the suite, as well as fails on the unfixed migration code in both parallel and non-parallel mode without corrupting the rest of the suite |
4a636cd
to
405db5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hamstap85 Thanks for the patch 👍 Welcome aboard ⛵
I added an alternative regression test to avoid migrate
calls and possible isolation issues. What do you think?
@felixxm oh I like that, very nice. I had seen how
So I spent most of my time trying to fight with it to get the actual migration operation to run, but I hadn't considered importing the object by string lookup. I'm still not completely familiar with the idea of importing a module that isn't a top-level So |
Exactly 👍 |
… multiple databases setup.
405db5b
to
316c68a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The testing approach is clever but I wish we had better testing facilities for migrations in general. It was proposed a few times on the developer mailing list but this is a good example of why a testing utility that would allow for tests to be executed in a context where some migrations are applied and other aren't on different databases would be useful.
django/contrib/contenttypes/migrations/0002_remove_content_type_name.py
Outdated
Show resolved
Hide resolved
This holds the fix in line with the work at this PR: django#15328
The ContentType legacy name field population operation would run on the
"default" database regardless of any specified alias
Found this while going through our code to ensure that it would smoothly run database restore operations on a given alias. It didn't cause any issues, I only found it by grepping our installed packages for migration operations to see if I should open any fix PRs.