Hotfix: make news audience migration non-atomic - #702
Merged
Conversation
TThanos3000
marked this pull request as ready for review
August 21, 2026 08:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
news.0010_news_audience_newscommentnon-atomic by addingatomic = False.0010after existingnews_newsrows are updated.Why
Production deploy for ref
9075dc9failed duringnews.0010_news_audience_newscommentwith PostgreSQLcannot ALTER TABLE news_news because it has pending trigger events. The migration combines schema changes, aRunPythonupdate onnews_news, andAddConstraintin one atomic transaction.atomic = Falseremoves that wrapping transaction; theRunPythonoperation does not passatomic=True, so it does not reintroduce one.Scope
news/models.py— master already has the matching schema.Checks
DEBUG=True python manage.py makemigrations --check --dry-run— passed, no changes detected.DEBUG=True python manage.py test news.tests.test_news_migration_0010 --verbosity=2— passed: 2 OK, 1 PostgreSQL-only regression skipped locally on sqlite.DEBUG=True python manage.py test news --verbosity=2— passed: 37 OK, 1 PostgreSQL-only regression skipped locally on sqlite.python -m flake8 news/migrations/0010_news_audience_newscomment.py news/tests/test_news_migration_0010.py— passed.python -m black --diff news/migrations/0010_news_audience_newscomment.py news/tests/test_news_migration_0010.py— passed: 2 files would be left unchanged.Note: local
black --check/blackprocess hung in this Windows shell after formatting, so final format verification was done withblack --diff, which exited successfully and reported no changes needed.