From aca9bb2a12b8985d0cb736d380db97439010cd98 Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Thu, 28 Apr 2022 17:23:15 +0200 Subject: Fixed #33413 -- Made migrations propage collations to related fields. --- django/db/backends/sqlite3/schema.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'django/db/backends/sqlite3') diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py index 21e1b35fce..55fdf5fbfe 100644 --- a/django/db/backends/sqlite3/schema.py +++ b/django/db/backends/sqlite3/schema.py @@ -455,7 +455,11 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): # Alter by remaking table self._remake_table(model, alter_field=(old_field, new_field)) # Rebuild tables with FKs pointing to this field. - if new_field.unique and old_type != new_type: + old_collation = old_db_params.get("collation") + new_collation = new_db_params.get("collation") + if new_field.unique and ( + old_type != new_type or old_collation != new_collation + ): related_models = set() opts = new_field.model._meta for remote_field in opts.related_objects: -- cgit v1.3