mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed #21783: Use defaults for adding NOT NULL on sqlite
This commit is contained in:
@@ -226,7 +226,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||
if isinstance(value, six.integer_types):
|
||||
return str(value)
|
||||
elif isinstance(value, six.string_types):
|
||||
return six.text_type(value)
|
||||
return '"%s"' % six.text_type(value)
|
||||
elif isinstance(value, type(True)):
|
||||
return str(int(value))
|
||||
elif value is None:
|
||||
|
||||
@@ -29,6 +29,11 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
# Add in any created fields
|
||||
for field in create_fields:
|
||||
body[field.name] = field
|
||||
# If there's a default, insert it into the copy map
|
||||
if field.get_default():
|
||||
mapping[field.column] = self.connection.ops.quote_parameter(
|
||||
field.get_default()
|
||||
)
|
||||
# Add in any altered fields
|
||||
for (old_field, new_field) in alter_fields:
|
||||
del body[old_field.name]
|
||||
|
||||
Reference in New Issue
Block a user