diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index bc8e54989e..578bfb244c 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -894,7 +894,7 @@ class BaseDatabaseSchemaEditor: def _create_index_sql(self, model, fields, *, name=None, suffix='', using='', db_tablespace=None, col_suffixes=(), sql=None, opclasses=(), - condition=''): + condition=None): """ 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 diff --git a/django/db/models/indexes.py b/django/db/models/indexes.py index 6bf8803e8b..a8bf089ba1 100644 --- a/django/db/models/indexes.py +++ b/django/db/models/indexes.py @@ -57,7 +57,7 @@ class Index: def _get_condition_sql(self, model, schema_editor): if self.condition is None: - return '' + return None query = Query(model=model) query.add_q(self.condition) compiler = query.get_compiler(connection=schema_editor.connection)