Used None as the empty value for condition in Index's SQL construction.
This commit is contained in:
parent
f4c0c0b0aa
commit
1e837c4b23
|
@ -894,7 +894,7 @@ class BaseDatabaseSchemaEditor:
|
||||||
|
|
||||||
def _create_index_sql(self, model, fields, *, name=None, suffix='', using='',
|
def _create_index_sql(self, model, fields, *, name=None, suffix='', using='',
|
||||||
db_tablespace=None, col_suffixes=(), sql=None, opclasses=(),
|
db_tablespace=None, col_suffixes=(), sql=None, opclasses=(),
|
||||||
condition=''):
|
condition=None):
|
||||||
"""
|
"""
|
||||||
Return the SQL statement to create the index for one or several fields.
|
Return the SQL statement to create the index for one or several fields.
|
||||||
`sql` can be specified if the syntax differs from the standard (GIS
|
`sql` can be specified if the syntax differs from the standard (GIS
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Index:
|
||||||
|
|
||||||
def _get_condition_sql(self, model, schema_editor):
|
def _get_condition_sql(self, model, schema_editor):
|
||||||
if self.condition is None:
|
if self.condition is None:
|
||||||
return ''
|
return None
|
||||||
query = Query(model=model)
|
query = Query(model=model)
|
||||||
query.add_q(self.condition)
|
query.add_q(self.condition)
|
||||||
compiler = query.get_compiler(connection=schema_editor.connection)
|
compiler = query.get_compiler(connection=schema_editor.connection)
|
||||||
|
|
Loading…
Reference in New Issue