changeset 628:914d57c80059

Fix database migrations now that we create settings groups.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Nov 2014 06:57:38 +0200
parents 18f52c7daf77
children 894a4a6bfb5f
files managedb.php
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/managedb.php	Sat Nov 01 06:38:26 2014 +0200
+++ b/managedb.php	Sat Nov 01 06:57:38 2014 +0200
@@ -147,16 +147,19 @@
       return FALSE;
     }
     
-    // Add group
-    echo " - Group '".$groupID."' -> ".$groupData[$groupID][1].".";
-    $sql = stDBPrepareSQL($outDB,
-      "INSERT INTO ".$groupTable." (name,description) VALUES (%s,%s)",
-      $groupData[$groupID][0], $groupData[$groupID][1]);
+    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)
-    {
-      echo "\nFailed to add group '".$groupID."'\n";
-      return FALSE;
+      if (($gid = stDBExecSQLInsert($outDB, $sql)) === false)
+      {
+        echo "\nFailed to add group '".$groupID."'\n";
+        return FALSE;
+      }
     }
     
     // Add settings to the group