Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #21917: Overly cautious SQLite3 backend for null fields + defaults

  • Loading branch information...
commit a7e2957110e8cac6ad5bf233ce4cc1fa528ac0e0 1 parent a5391db
@andrewgodwin andrewgodwin authored
Showing with 0 additions and 5 deletions.
  1. +0 −5 django/db/backends/sqlite3/schema.py
View
5 django/db/backends/sqlite3/schema.py
@@ -88,11 +88,6 @@ def add_field(self, model, field):
# Special-case implicit M2M tables
if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
return self.create_model(field.rel.through)
- # Detect bad field combinations
- if (not field.null and
- (not field.has_default() or field.get_default() is None) and
- not field.empty_strings_allowed):
- raise ValueError("You cannot add a null=False column without a default value on SQLite.")
self._remake_table(model, create_fields=[field])
def remove_field(self, model, field):

2 comments on commit a7e2957

@malthejorgensen

Do you know why this was overly cautious? I'm planning on backporting this to South.

@andrewgodwin

You can in fact do this if there's no data, I believe - the error was definitely giving false positives, can't remember too much more than that.

Please sign in to comment.
Something went wrong with that request. Please try again.