Default ends_with_default to False
Problem: Previously in gh-117 we aimed to solve gh-115, which described a problem where we used `SET DEFAULT` and then `DROP DEFAULT` immediately afterward. The solution was to track whether any defaults are retained, but the `ends_with_default` variable is initialized as `None` rather than `False`. At the end of the function we check whether `ends_with_default is False`, never occurs unless a default is set. Solution: Assume that there is no default unless proven otherwise, and iniitializie `ends_with_default` to `False` instead of `None`. Fixes: gh-158
This commit is contained in:
1 parent
3f0531f349
commit
397c1f0e16
2 files changed
+16
-1
No files matched your search
@@ -8,7 +8,7 @@ logger = logging.getLogger("django_migration_linter")
|
||||
|
||||
def has_not_null_column(sql_statements, **kwargs):
|
||||
# TODO: improve to detect that the same column is concerned
|
||||
ends_with_default = None
|
||||
ends_with_default = False
|
||||
for sql in sql_statements:
|
||||
if "SET DEFAULT" in sql:
|
||||
ends_with_default = True
|
||||
|
||||
Reference in new issue
Block a user