Skip to content

Hotfix: make news audience migration non-atomic - #702

Merged
TThanos3000 merged 1 commit into
masterfrom
hotfix/master-news-0010-nonatomic
Aug 21, 2026
Merged

Hotfix: make news audience migration non-atomic#702
TThanos3000 merged 1 commit into
masterfrom
hotfix/master-news-0010-nonatomic

Conversation

@TThanos3000

Copy link
Copy Markdown
Collaborator

Summary

  • Makes existing production migration news.0010_news_audience_newscomment non-atomic by adding atomic = False.
  • Adds regression coverage for the migration atomicity contract and a PostgreSQL-only replay scenario for applying 0010 after existing news_news rows are updated.

Why

Production deploy for ref 9075dc9 failed during news.0010_news_audience_newscomment with PostgreSQL cannot ALTER TABLE news_news because it has pending trigger events. The migration combines schema changes, a RunPython update on news_news, and AddConstraint in one atomic transaction. atomic = False removes that wrapping transaction; the RunPython operation does not pass atomic=True, so it does not reintroduce one.

Scope

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/black process hung in this Windows shell after formatting, so final format verification was done with black --diff, which exited successfully and reported no changes needed.

@TThanos3000
TThanos3000 marked this pull request as ready for review August 21, 2026 08:00
@TThanos3000
TThanos3000 merged commit 70766a1 into master Aug 21, 2026
5 checks passed
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.

1 participant