]> git.proxmox.com Git - pmg-api.git/commitdiff
use database_column_exists to check if column already exists
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 28 Dec 2017 10:22:35 +0000 (11:22 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 28 Dec 2017 10:22:35 +0000 (11:22 +0100)
PMG/DBTools.pm

index 266e78cc8089314e32920a4cceded259129120da..30a6aedb8771439e9c8cdb7ef69b3ea29c06c4e9 100644 (file)
@@ -486,10 +486,10 @@ sub upgradedb {
     cond_create_std_actions($ruledb);
 
     # upgrade tables here if necessary
-    eval {
+    if (!database_column_exists($dbh, 'LocalStat', 'PregreetCount')) {
        $dbh->do("ALTER TABLE LocalStat ADD COLUMN " .
                 "PregreetCount INTEGER DEFAULT 0 NOT NULL");
-    };
+    }
 
     # add missing TicketID to CMSReceivers
     if (!database_column_exists($dbh, 'CMSReceivers', 'TicketID')) {