Fixed #31248 -- Added missing space before USING SQL on PostGIS.
This commit is contained in:
parent
382af9b141
commit
adcf1a7308
|
@ -37,7 +37,7 @@ class PostGISSchemaEditor(DatabaseSchemaEditor):
|
||||||
self.sql_create_index,
|
self.sql_create_index,
|
||||||
name=self.quote_name('%s_%s_id' % (model._meta.db_table, field.column)),
|
name=self.quote_name('%s_%s_id' % (model._meta.db_table, field.column)),
|
||||||
table=self.quote_name(model._meta.db_table),
|
table=self.quote_name(model._meta.db_table),
|
||||||
using='USING %s' % self.geom_index_type,
|
using=' USING %s' % self.geom_index_type,
|
||||||
columns=field_column,
|
columns=field_column,
|
||||||
extra='',
|
extra='',
|
||||||
condition='',
|
condition='',
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
from unittest import skipUnless
|
||||||
|
|
||||||
|
from django.db import connection
|
||||||
|
from django.db.models import Index
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from ..utils import postgis
|
||||||
|
from .models import City
|
||||||
|
|
||||||
|
|
||||||
|
class SchemaIndexesTests(TestCase):
|
||||||
|
@skipUnless(postgis, 'This is a PostGIS-specific test.')
|
||||||
|
def test_using_sql(self):
|
||||||
|
index = Index(fields=['point'])
|
||||||
|
editor = connection.schema_editor()
|
||||||
|
self.assertIn(
|
||||||
|
'%s USING ' % editor.quote_name(City._meta.db_table),
|
||||||
|
str(index.create_sql(City, editor)),
|
||||||
|
)
|
Loading…
Reference in New Issue