summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-06-19 11:02:53 -0400
committerTim Graham <timograham@gmail.com>2014-06-19 11:02:53 -0400
commit30d8b95139a1fa3070f3b112115e624ffcf8e555 (patch)
tree29f0fdfb6d7b292dc009a4a840670aa63a764533
parent427f218a5ecec315a18583c1013e315d9102d6d3 (diff)
[1.7.x] Added feature for implied null (needed for Firebird backend)
Backport of 1b07781292 from master
-rw-r--r--django/db/backends/__init__.py3
-rw-r--r--django/db/backends/schema.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 5636b56d14..b149a94f19 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -750,6 +750,9 @@ class BaseDatabaseFeatures(object):
# Suffix for backends that don't support "SELECT xxx;" queries.
bare_select_suffix = ''
+ # If NULL is implied on columns without needing to be explicitly specified
+ implied_column_null = False
+
uppercases_column_names = False
def __init__(self, connection):
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py
index 3360d36a9b..8fdc3083c9 100644
--- a/django/db/backends/schema.py
+++ b/django/db/backends/schema.py
@@ -133,9 +133,9 @@ class BaseDatabaseSchemaEditor(object):
if (field.empty_strings_allowed and not field.primary_key and
self.connection.features.interprets_empty_strings_as_nulls):
null = True
- if null:
+ if null and not self.connection.features.implied_column_null:
sql += " NULL"
- else:
+ elif not null:
sql += " NOT NULL"
# Primary key/unique outputs
if field.primary_key: