]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Modified mysql to not add AUTOINCREMENT to the first integer primary key if it is...
authorRobert Leftwich <rtl@pobox.com>
Wed, 1 Mar 2006 09:37:45 +0000 (09:37 +0000)
committerRobert Leftwich <rtl@pobox.com>
Wed, 1 Mar 2006 09:37:45 +0000 (09:37 +0000)
lib/sqlalchemy/databases/mysql.py

index d660db7bdc69aa09f65cd3eb7e3bacc85d34802e..bcd7f50954b847f4a000d685a4c499ce0b8da9a4 100644 (file)
@@ -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)