45 | | @@ -131,3 +132,11 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): |
46 | | if old_field.unique and not (new_field.db_index or new_field.unique): |
47 | | index_to_remove = self._create_index_name(model._meta.db_table, [old_field.column], suffix='_like') |
48 | | self.execute(self._delete_constraint_sql(self.sql_delete_index, model, index_to_remove)) |
49 | | + |
50 | | + |
51 | | + def _alter_column_null_sql(self, model, old_field, new_field): |
52 | | + if (self.connection.features.interprets_empty_strings_as_nulls and |
53 | | + new_field.get_internal_type() in ("CICharField", "CITextField")): |
54 | | + # The field is nullable in the database anyway, leave it alone. |
55 | | + return |
56 | | + return super()._alter_column_null_sql(model, old_field, new_field |