Repository navigation
Conversation
Django treats RunPython(code, None) and RunSQL(sql, reverse_sql=None) as irreversible, the same as leaving the argument out, but the runpython_no_reverse and runsql_no_reverse rules only fired when the argument was missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
RunPython(forward, None),RunPython(forward, reverse_code=None)andRunSQL(sql, reverse_sql=None)are irreversible in Django:RunSQL.reversibleisreverse_sql is not None,RunPython.reversibleisreverse_code is not None, and migrating backwards raisesNotImplementedError("You cannot reverse this operation").runpython_no_reverseandrunsql_no_reverseonly fired when the argument was left out, so an explicitNonegot no warning.Both rules now share a small
_lacks_reversehelper that treats a missing argument or a literalNonethe same way. A starred positional (RunSQL(sql, *rest)) is still assumed to possibly carry a reverse, as before.Tests
RunSQLTest.test_positive_explicit_none_reverseandRunPythonNoReverseTest.test_positive_explicit_none_reversecheck the positional and keywordNoneforms as subtests. All four subtests fail on main and pass with the change.cd cli && python -m pytest -q: 1431 passed, 6 skipped.ruff checkandmypyas in CI: clean.This change was written with the help of Claude Code (AI). I reviewed it and ran the tests above.
🤖 Generated with Claude Code
Summary by CodeRabbit
None, as well as when it is omitted, for SQL and Python migrations.