|
@@ -1,6 +1,5 @@
|
|
|
|
|
|
|
|
|
-import django
|
|
|
from django.db import migrations
|
|
|
|
|
|
|
|
@@ -13,10 +12,7 @@ def set_replication_identity(schema_editor, model, column_names):
|
|
|
|
|
|
if not unique_constraint_names:
|
|
|
|
|
|
- if django.VERSION[:2] < (2, 0):
|
|
|
- index = schema_editor._create_index_name(model, column_names, "_uniq")
|
|
|
- else:
|
|
|
- index = schema_editor._create_index_name(model._meta.db_table, column_names, "_uniq")
|
|
|
+ index = schema_editor._create_index_name(model._meta.db_table, column_names, "_uniq")
|
|
|
|
|
|
cursor.execute(
|
|
|
f'CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS {schema_editor.quote_name(index)} ON {schema_editor.quote_name(model._meta.db_table)} ({", ".join(schema_editor.quote_name(col) for col in column_names)});'
|