Kaydet (Commit) a7e29571 authored tarafından Andrew Godwin's avatar Andrew Godwin

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

üst a5391db7
...@@ -88,11 +88,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): ...@@ -88,11 +88,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
# Special-case implicit M2M tables # Special-case implicit M2M tables
if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created: if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
return self.create_model(field.rel.through) 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]) self._remake_table(model, create_fields=[field])
def remove_field(self, model, field): def remove_field(self, model, field):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment