From: Robert Leftwich Date: Wed, 1 Mar 2006 09:37:45 +0000 (+0000) Subject: Modified mysql to not add AUTOINCREMENT to the first integer primary key if it is... X-Git-Tag: rel_0_1_3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=371a6ca0de39b0affc25852b782898f2497eaeb0;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Modified mysql to not add AUTOINCREMENT to the first integer primary key if it is also a foreign key. --- diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index d660db7bdc..bcd7f50954 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -261,7 +261,7 @@ class MySQLSchemaGenerator(ansisql.ANSISchemaGenerator): if column.primary_key: if not override_pk: colspec += " PRIMARY KEY" - if first_pk and isinstance(column.type, types.Integer): + if not column.foreign_key and first_pk and isinstance(column.type, types.Integer): colspec += " AUTO_INCREMENT" if column.foreign_key: colspec += ", FOREIGN KEY (%s) REFERENCES %s(%s)" % (column.name, column.foreign_key.column.table.name, column.foreign_key.column.name)