Browse files

Implemented #10164 for new schema migration code.

Made it use 'AUTOINCREMENT' suffix for PK creation. This way it doeesn't
regress when compared with the 'traditional' DB backend creation
infrastructure.

Refs #10164.
  • Loading branch information...
1 parent f28ea02 commit 6a6136141b133aff7583d51d687719961d261244 @ramiro ramiro committed Dec 28, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/db/backends/schema.py
View
6 django/db/backends/schema.py
@@ -185,6 +185,10 @@ def create_model(self, model):
db_params = field.db_parameters(connection=self.connection)
if db_params['check']:
definition += " CHECK (%s)" % db_params['check']
+ # Autoincrement SQL (for backends with inline variant)
+ col_type_suffix = field.db_type_suffix(connection=self.connection)
+ if col_type_suffix:
+ definition += " %s" % col_type_suffix
# Add the SQL to our big list
column_sqls.append("%s %s" % (
self.quote_name(field.column),
@@ -214,7 +218,7 @@ def create_model(self, model):
"to_column": self.quote_name(to_column),
}
)
- # Autoincrement SQL
+ # Autoincrement SQL (for backends with post table definition variant)
if field.get_internal_type() == "AutoField":
autoinc_sql = self.connection.ops.autoinc_sql(model._meta.db_table, field.column)
if autoinc_sql:

0 comments on commit 6a61361

Please sign in to comment.