diff MySQL/Plugins/MySQLIndex.cpp @ 238:f033cc039264

new table: "ServerProperties"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Apr 2021 19:33:36 +0200
parents 35598014f140
children a063bbf10a3e
line wrap: on
line diff
--- a/MySQL/Plugins/MySQLIndex.cpp	Thu Apr 08 19:09:04 2021 +0200
+++ b/MySQL/Plugins/MySQLIndex.cpp	Thu Apr 08 19:33:36 2021 +0200
@@ -267,8 +267,23 @@
         LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision;
         throw Orthanc::OrthancException(Orthanc::ErrorCode_Database);        
       }
+
+
+      {
+        // New in release 4.0 to deal with multiple writers
+        DatabaseManager::Transaction t(manager, TransactionType_ReadWrite);
+
+        if (!t.DoesTableExist("ServerProperties"))
+        {
+          t.ExecuteMultiLines("CREATE TABLE ServerProperties(server VARCHAR(64) NOT NULL, "
+                              "property INTEGER, value TEXT, PRIMARY KEY(server, property))");
+        }
+
+        t.Commit();
+      }
     }
 
+    
     /**
      * WARNING: This lock must be acquired after
      * "MYSQL_LOCK_DATABASE_SETUP" is released. Indeed, in MySQL <