Fix location of tablespace clauses in schema backend column SQL
This commit is contained in:
parent
8363406dad
commit
2787de652a
|
@ -107,10 +107,6 @@ class BaseDatabaseSchemaEditor(object):
|
||||||
# Check for fields that aren't actually columns (e.g. M2M)
|
# Check for fields that aren't actually columns (e.g. M2M)
|
||||||
if sql is None:
|
if sql is None:
|
||||||
return None
|
return None
|
||||||
# Optionally add the tablespace if it's an implicitly indexed column
|
|
||||||
tablespace = field.db_tablespace or model._meta.db_tablespace
|
|
||||||
if tablespace and self.connection.features.supports_tablespaces and field.unique:
|
|
||||||
sql += " %s" % self.connection.ops.tablespace_sql(tablespace, inline=True)
|
|
||||||
# Work out nullability
|
# Work out nullability
|
||||||
null = field.null
|
null = field.null
|
||||||
# If we were told to include a default value, do so
|
# If we were told to include a default value, do so
|
||||||
|
@ -138,6 +134,10 @@ class BaseDatabaseSchemaEditor(object):
|
||||||
sql += " PRIMARY KEY"
|
sql += " PRIMARY KEY"
|
||||||
elif field.unique:
|
elif field.unique:
|
||||||
sql += " UNIQUE"
|
sql += " UNIQUE"
|
||||||
|
# Optionally add the tablespace if it's an implicitly indexed column
|
||||||
|
tablespace = field.db_tablespace or model._meta.db_tablespace
|
||||||
|
if tablespace and self.connection.features.supports_tablespaces and field.unique:
|
||||||
|
sql += " %s" % self.connection.ops.tablespace_sql(tablespace, inline=True)
|
||||||
# Return the sql
|
# Return the sql
|
||||||
return sql, params
|
return sql, params
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue