0
0
mirror of https://github.com/django/django.git synced 2024-11-29 22:56:46 +01:00

Fixed #26966 -- Made MySQL backend skip defaults for JSON columns

Thanks mcgeeco for reporting, and claudep and timgraham for review.
This commit is contained in:
Adam Chainz 2016-08-01 18:51:25 +01:00 committed by Tim Graham
parent 374b6091ac
commit 4b1c9708d6

View File

@ -27,8 +27,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
def skip_default(self, field):
"""
MySQL doesn't accept default values for TEXT and BLOB types, and
implicitly treats these columns as nullable.
MySQL doesn't accept default values for some data types and implicitly
treats these columns as nullable.
"""
db_type = field.db_type(self.connection)
return (
@ -36,6 +36,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
db_type.lower() in {
'tinyblob', 'blob', 'mediumblob', 'longblob',
'tinytext', 'text', 'mediumtext', 'longtext',
'json',
}
)