Used Statement in PostGISSchemaEditor._create_index_sql().

This commit is contained in:
Mads Jensen 2019-09-11 07:51:31 +02:00 committed by Mariusz Felisiak
parent 9a2a12d415
commit b616908ce1
1 changed files with 10 additions and 8 deletions

View File

@ -1,3 +1,4 @@
from django.db.backends.ddl_references import Statement
from django.db.backends.postgresql.schema import DatabaseSchemaEditor from django.db.backends.postgresql.schema import DatabaseSchemaEditor
@ -32,14 +33,15 @@ class PostGISSchemaEditor(DatabaseSchemaEditor):
# Use "nd" ops which are fast on multidimensional cases # Use "nd" ops which are fast on multidimensional cases
field_column = "%s %s" % (field_column, self.geom_index_ops_nd) field_column = "%s %s" % (field_column, self.geom_index_ops_nd)
return self.sql_create_index % { return Statement(
"name": self.quote_name('%s_%s_id' % (model._meta.db_table, field.column)), self.sql_create_index,
"table": self.quote_name(model._meta.db_table), name=self.quote_name('%s_%s_id' % (model._meta.db_table, field.column)),
"using": "USING %s" % self.geom_index_type, table=self.quote_name(model._meta.db_table),
"columns": field_column, using='USING %s' % self.geom_index_type,
"extra": '', columns=field_column,
"condition": '', extra='',
} condition='',
)
def _alter_column_type_sql(self, table, old_field, new_field, new_type): def _alter_column_type_sql(self, table, old_field, new_field, new_type):
""" """