diff options
| author | Adam Johnson <me@adamj.eu> | 2024-08-29 18:52:31 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-10-10 13:18:46 +0200 |
| commit | cee95e6172f2ea3dbf8cfd4214562cfc92f95392 (patch) | |
| tree | b1fc28212831bb587d56c10bcec7130313baea0a /django/contrib/postgres | |
| parent | 68cee15a8fd65bd6ee2329d80331f87cadd97ff5 (diff) | |
Fixed #35717 -- Reduced Create/RemoveCollation operations when optimizing migrations.
Diffstat (limited to 'django/contrib/postgres')
| -rw-r--r-- | django/contrib/postgres/operations.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/contrib/postgres/operations.py b/django/contrib/postgres/operations.py index 1ee5fbc2e2..84360febf9 100644 --- a/django/contrib/postgres/operations.py +++ b/django/contrib/postgres/operations.py @@ -237,6 +237,11 @@ class CreateCollation(CollationOperation): def migration_name_fragment(self): return "create_collation_%s" % self.name.lower() + def reduce(self, operation, app_label): + if isinstance(operation, RemoveCollation) and self.name == operation.name: + return [] + return super().reduce(operation, app_label) + class RemoveCollation(CollationOperation): """Remove a collation.""" |
