Skip to content

19644 Make atomic use correct database instead of default #19651

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

Merged
merged 7 commits into from
Jun 25, 2025

Conversation

arthanson
Copy link
Collaborator

Fixes: #19644

transaction.atomic will go to the default database, this is normally not a problem but if multiple schemas are databases are configured using a router (like with the branching plugin) this will be incorrect as the atomic wrapper should be done on the database the changes are made on.

In jobs.py the script running code is a special case as the script could potentially modify models in multiple schemas so both the default database needs a wrapper and any model specific ones - arbitrarily used device as the model to key off, but any ChangeLogged model could be used.

arthanson added 4 commits June 5, 2025 09:02
@arthanson arthanson marked this pull request as ready for review June 5, 2025 17:07
@arthanson arthanson requested review from a team and bctiemann and removed request for a team June 5, 2025 17:07
@jeremystretch jeremystretch requested review from jeremystretch and removed request for bctiemann June 6, 2025 17:44
@arthanson arthanson requested a review from jeremystretch June 20, 2025 16:21
@arthanson arthanson requested a review from jeremystretch June 24, 2025 17:22
@jeremystretch jeremystretch merged commit a17699d into main Jun 25, 2025
10 checks passed
@jeremystretch jeremystretch deleted the 19644-atomic-branching branch June 25, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Atomic transactions go to default database by default
2 participants