From 4b1c9708d629c08ebbd73293c89a159ccb436d4d Mon Sep 17 00:00:00 2001 From: Adam Chainz Date: Mon, 1 Aug 2016 18:51:25 +0100 Subject: [PATCH] Fixed #26966 -- Made MySQL backend skip defaults for JSON columns Thanks mcgeeco for reporting, and claudep and timgraham for review. --- django/db/backends/mysql/schema.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py index 4aa40f7cb5..4a61807234 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -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', } )