changeset 629:894a4a6bfb5f fap2013

Better fix for the DB migration issue.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Nov 2014 07:03:10 +0200
parents 914d57c80059
children b84fc6e7847e
files managedb.php
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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