From 97a1f5c6c9114a00649b5929146c161b22c17fc1 Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Mon, 3 Jul 2023 20:32:13 +0200 Subject: [PATCH] Fix #250 -- Don't consider partial index creation as making a column not nullable. --- CHANGELOG.md | 10 ++++++++++ django_migration_linter/sql_analyser/base.py | 3 ++- tests/unit/test_sql_analyser.py | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5499ef8..beafd65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,18 @@ Instead, the linter crashes and lets the `sqlmigrate` error raise, in order to avoid letting a problematic migration pass. One common reason for such an error is the SQL generation which requires the database to be actually migrated in order to fetch actual constraint names from it. The crash is a sign to double-check the migration. But if you are certain the migration is safe, you can ignore it (issue #209) + +Features: + - Fixed `RunPython` model import check when using a `through` object like `MyModel.many_to_many.through.objects.filter(...)` (issue #218) - Mark the `IgnoreMigration` operation as `elidable=True` + +Bug: + +- Don't detect not nullable field on partial index creation (issue #250) + +Miscellaneous: + - Add support for Python 3.11 - Add support for Django 4.1 - Add support for Django 4.2 diff --git a/django_migration_linter/sql_analyser/base.py b/django_migration_linter/sql_analyser/base.py index 2fa0646..131652e 100644 --- a/django_migration_linter/sql_analyser/base.py +++ b/django_migration_linter/sql_analyser/base.py @@ -40,7 +40,8 @@ def has_not_null_column(sql_statements: list[str], **kwargs) -> bool: ends_with_default = False return ( any( - re.search("(?