mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #24846 -- Added support to MySQL SchemaEditor for all blob/text data types
This commit is contained in:
		| @@ -34,10 +34,17 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): | ||||
|  | ||||
|     def skip_default(self, field): | ||||
|         """ | ||||
|         MySQL doesn't accept default values for longtext and longblob | ||||
|         and implicitly treats these columns as nullable. | ||||
|         MySQL doesn't accept default values for TEXT and BLOB types, and | ||||
|         implicitly treats these columns as nullable. | ||||
|         """ | ||||
|         return field.db_type(self.connection) in {'longtext', 'longblob'} | ||||
|         db_type = field.db_type(self.connection) | ||||
|         return ( | ||||
|             db_type is not None and | ||||
|             db_type.lower() in { | ||||
|                 'tinyblob', 'blob', 'mediumblob', 'longblob', | ||||
|                 'tinytext', 'text', 'mediumtext', 'longtext', | ||||
|             } | ||||
|         ) | ||||
|  | ||||
|     def add_field(self, model, field): | ||||
|         super(DatabaseSchemaEditor, self).add_field(model, field) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user