diff options
| author | Hannes Ljungberg <hannes@5monkeys.se> | 2019-10-23 22:16:55 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-10-24 09:33:14 +0200 |
| commit | fa5f3291e7f2611d53e64ab481ebe951b0161791 (patch) | |
| tree | 2b3e7dc860d5d80df16d79122549469b957019be /django | |
| parent | 2a54ce72f95977fefe796e99c7bbf6cd366927f9 (diff) | |
Fixed #30903 -- Fixed migrations crash on PostgreSQL when adding Index with opclasses and ordering.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/ddl_references.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/django/db/backends/ddl_references.py b/django/db/backends/ddl_references.py index d71f6169ea..44e49806f8 100644 --- a/django/db/backends/ddl_references.py +++ b/django/db/backends/ddl_references.py @@ -110,13 +110,14 @@ class IndexColumns(Columns): def __str__(self): def col_str(column, idx): - try: - col = self.quote_name(column) + self.col_suffixes[idx] - except IndexError: - col = self.quote_name(column) # Index.__init__() guarantees that self.opclasses is the same # length as self.columns. - return '{} {}'.format(col, self.opclasses[idx]) + col = '{} {}'.format(self.quote_name(column), self.opclasses[idx]) + try: + col = '{} {}'.format(col, self.col_suffixes[idx]) + except IndexError: + pass + return col return ', '.join(col_str(column, idx) for idx, column in enumerate(self.columns)) |
