summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/schema.py
diff options
context:
space:
mode:
authorDavid Wobrock <david.wobrock@gmail.com>2022-04-28 17:23:15 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-02 08:13:38 +0200
commitaca9bb2a12b8985d0cb736d380db97439010cd98 (patch)
treeaf4ec72f8306b0bd806725b35c616db6fddbb42c /django/db/backends/sqlite3/schema.py
parent694cf458f16b8d340a3195244196980b2dec34fd (diff)
downloaddjango-aca9bb2a12b8985d0cb736d380db97439010cd98.tar.gz
Fixed #33413 -- Made migrations propage collations to related fields.
Diffstat (limited to 'django/db/backends/sqlite3/schema.py')
-rw-r--r--django/db/backends/sqlite3/schema.py6
1 files changed, 5 insertions, 1 deletions
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: