# HG changeset patch # User Matti Hamalainen # Date 1414818190 -7200 # Node ID 894a4a6bfb5fa69e4d541cc0df8116b766613dd2 # Parent 914d57c800595d28c0bba1cf858eab8ec5a1af2b Better fix for the DB migration issue. diff -r 914d57c80059 -r 894a4a6bfb5f managedb.php --- a/managedb.php Sat Nov 01 06:57:38 2014 +0200 +++ b/managedb.php Sat Nov 01 07:03:10 2014 +0200 @@ -147,19 +147,16 @@ return FALSE; } - if ($upgrade) + // Add group, if needed + echo " - Group '".$groupID."' -> ".$groupData[$groupID][1]."."; + $sql = stDBPrepareSQL($outDB, + "INSERT INTO ".$groupTable." (name,description) VALUES (%s,%s)", + $groupData[$groupID][0], $groupData[$groupID][1]); + + if (($gid = stDBExecSQLInsert($outDB, $sql)) === false) { - // Add group, if needed - echo " - Group '".$groupID."' -> ".$groupData[$groupID][1]."."; - $sql = stDBPrepareSQL($outDB, - "INSERT INTO ".$groupTable." (name,description) VALUES (%s,%s)", - $groupData[$groupID][0], $groupData[$groupID][1]); - - if (($gid = stDBExecSQLInsert($outDB, $sql)) === false) - { - echo "\nFailed to add group '".$groupID."'\n"; - return FALSE; - } + echo "\nFailed to add group '".$groupID."'\n"; + return FALSE; } // Add settings to the group @@ -475,7 +472,7 @@ stAddSettingsNormal($inDB, $outDB, $dbMetaData, "dbmeta", TRUE); // Migrate other tables - if (!stMigrateTables($inDB, $outDB, $upgrade, array("settings", "display_vars", "dbmeta"))) + if (!stMigrateTables($inDB, $outDB, $upgrade, array("settings", "display_vars", "dbmeta", "settings_groups"))) exit; // Set new database version