mysql2sqlite
mysql2sqlite copied to clipboard
Double primary key statement in create table with autoincrement fields
At the create table, fields with auto_increment
are turned into primary key autoincrement
. This is fine but if the field has already the primary key it ends up with two, like this:
`id` integer NOT NULL PRIMARY KEY PRIMARY KEY AUTOINCREMENT
I fixed it adding the line 99, that removes any previous primary key
. Hope this helps.
97 if ( match( $0, /[^"`]AUTO_INCREMENT|auto_increment[^"`]/)) {
98 aInc = 1;
99 gsub( /PRIMARY KEY/, "" )
100 gsub( /AUTO_INCREMENT|auto_increment/, "PRIMARY KEY AUTOINCREMENT" )
101 }