1
0
mirror of https://github.com/django/django.git synced 2025-01-03 15:06:09 +00: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): def skip_default(self, field):
""" """
MySQL doesn't accept default values for TEXT and BLOB types, and MySQL doesn't accept default values for some data types and implicitly
implicitly treats these columns as nullable. treats these columns as nullable.
""" """
db_type = field.db_type(self.connection) db_type = field.db_type(self.connection)
return ( return (
@ -36,6 +36,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
db_type.lower() in { db_type.lower() in {
'tinyblob', 'blob', 'mediumblob', 'longblob', 'tinyblob', 'blob', 'mediumblob', 'longblob',
'tinytext', 'text', 'mediumtext', 'longtext', 'tinytext', 'text', 'mediumtext', 'longtext',
'json',
} }
) )