1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #24390 -- Made migration index names deterministic.

This commit is contained in:
László Károlyi
2015-02-25 19:48:35 +01:00
committed by Tim Graham
parent 4fdc7015c0
commit f37c11eea3
2 changed files with 14 additions and 1 deletions

View File

@@ -798,7 +798,7 @@ class BaseDatabaseSchemaEditor(object):
)
# Else generate the name for the index using a different algorithm
table_name = model._meta.db_table.replace('"', '').replace('.', '_')
index_unique_name = '_%x' % abs(hash((table_name, ','.join(column_names))))
index_unique_name = '_%s' % self._digest(*column_names)
max_length = self.connection.ops.max_name_length() or 200
# If the index name is too long, truncate it
index_name = ('%s_%s%s%s' % (