2
0
Эх сурвалжийг харах

[Web] Do not break init_db when switching branches

André Peters 7 жил өмнө
parent
commit
7a69586d91

+ 5 - 1
data/web/inc/init_db.inc.php

@@ -625,7 +625,11 @@ function init_db_schema() {
         $stmt = $pdo->query("SHOW TABLES LIKE 'quarantaine'");
         $stmt = $pdo->query("SHOW TABLES LIKE 'quarantaine'");
         $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
         $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
         if ($num_results != 0) {
         if ($num_results != 0) {
-          $pdo->query("RENAME TABLE `quarantaine` TO `quarantine`");
+          $stmt = $pdo->query("SHOW TABLES LIKE 'quarantine'");
+          $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
+          if ($num_results == 0) {
+            $pdo->query("RENAME TABLE `quarantaine` TO `quarantine`");
+          }
         }
         }
       }
       }
       $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'");
       $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'");