Skip to content

Commit

Permalink
Fix: allow adding primary key field with auto_increment when table al…
Browse files Browse the repository at this point in the history
…ready exists when using MySQL.

git-svn-id: http://voip.null.ro/svn/ansql/trunk@329 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
monica committed May 18, 2017
1 parent 3e97373 commit c78b6ce
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,13 @@ public static function updateTable($table,$vars)
$type = "int4";
if ($type == "bigserial")
$type = "int8";
if ($type == "bigint(20) unsigned not null auto_increment")
$type = "bigint(20)";
if ($type == "bigint(20) unsigned not null auto_increment") {
if ($db_type!="mysql" || strlen($var->_key)) {
$type = "bigint(20)";
} else {
$type .= ", ADD primary key ($name)";
}
}

Debug::Output('dbstruct', _("No field")." '$name' "._("in table")." '$table'".(", we'll create it"));

Expand Down

0 comments on commit c78b6ce

Please sign in to comment.