From fe074c96a343530beea50fbdd0803d3e7b739e8e Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Tue, 27 Jul 2021 10:50:06 -0400 Subject: [PATCH] Refs #32962 -- Simplified NULL logic in BaseDatabaseSchemaEditor._iter_column_sql(). --- django/db/backends/base/schema.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index 96182bed56..d117241fee 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -245,10 +245,10 @@ class BaseDatabaseSchemaEditor: if (field.empty_strings_allowed and not field.primary_key and self.connection.features.interprets_empty_strings_as_nulls): null = True - if null and not self.connection.features.implied_column_null: - yield 'NULL' - elif not null: + if not null: yield 'NOT NULL' + elif not self.connection.features.implied_column_null: + yield 'NULL' if field.primary_key: yield 'PRIMARY KEY' elif field.unique: