Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix location of tablespace clauses in schema backend column SQL

  • Loading branch information...
commit 2787de652af50917bdbadf6c4f2eb6f8603e65f2 1 parent 8363406
@andrewgodwin andrewgodwin authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 django/db/backends/schema.py
View
8 django/db/backends/schema.py
@@ -107,10 +107,6 @@ def column_sql(self, model, field, include_default=False):
# Check for fields that aren't actually columns (e.g. M2M)
if sql is 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
null = field.null
# If we were told to include a default value, do so
@@ -138,6 +134,10 @@ def column_sql(self, model, field, include_default=False):
sql += " PRIMARY KEY"
elif field.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 sql, params
Please sign in to comment.
Something went wrong with that request. Please try again.