diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-08-23 14:38:55 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-08-23 14:38:55 +0100 |
| commit | 2787de652af50917bdbadf6c4f2eb6f8603e65f2 (patch) | |
| tree | c54e9701e9668c84b2a17451164fefbc66da16a0 | |
| parent | 8363406dadbbda02c163687e89b5971ebba3597b (diff) | |
Fix location of tablespace clauses in schema backend column SQL
| -rw-r--r-- | django/db/backends/schema.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py index 64098499f6..82286c5e87 100644 --- a/django/db/backends/schema.py +++ b/django/db/backends/schema.py @@ -107,10 +107,6 @@ class BaseDatabaseSchemaEditor(object): # 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 @@ class BaseDatabaseSchemaEditor(object): 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 |
