changeset 221:73cc85f3d9c1

implementation of the "serverIdentifier" information for global properties
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 10:40:34 +0200
parents 492aa3edf572
children c8e06b41feec
files Framework/Common/DatabaseManager.h Framework/Plugins/DatabaseBackendAdapterV2.cpp Framework/Plugins/DatabaseBackendAdapterV3.cpp Framework/Plugins/GlobalProperties.cpp Framework/Plugins/GlobalProperties.h Framework/Plugins/IDatabaseBackend.h Framework/Plugins/IndexBackend.cpp Framework/Plugins/IndexBackend.h Framework/Plugins/IndexUnitTests.h MySQL/Plugins/MySQLIndex.cpp PostgreSQL/Plugins/PostgreSQLIndex.cpp PostgreSQL/UnitTests/PostgreSQLTests.cpp SQLite/Plugins/SQLiteIndex.cpp
diffstat 13 files changed, 75 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Common/DatabaseManager.h	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Common/DatabaseManager.h	Tue Mar 30 10:40:34 2021 +0200
@@ -30,6 +30,7 @@
 #include <boost/thread/recursive_mutex.hpp>
 #include <memory>
 
+
 namespace OrthancDatabases
 {
   class DatabaseManager : public boost::noncopyable
--- a/Framework/Plugins/DatabaseBackendAdapterV2.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV2.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -21,6 +21,7 @@
 
 
 #include "DatabaseBackendAdapterV2.h"
+#include "GlobalProperties.h"
 
 #include <OrthancException.h>
 
@@ -849,7 +850,7 @@
     try
     {
       std::string s;
-      if (backend->LookupGlobalProperty(s, property))
+      if (backend->LookupGlobalProperty(s, MISSING_SERVER_IDENTIFIER, property))
       {
         OrthancPluginDatabaseAnswerString(backend->GetContext(),
                                           output->GetDatabase(),
@@ -1045,7 +1046,7 @@
 
     try
     {
-      backend->SetGlobalProperty(property, value);
+      backend->SetGlobalProperty(MISSING_SERVER_IDENTIFIER, property, value);
       return OrthancPluginErrorCode_Success;
     }
     ORTHANC_PLUGINS_DATABASE_CATCH;
--- a/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -1490,6 +1490,7 @@
 
 
   static OrthancPluginErrorCode LookupGlobalProperty(OrthancPluginDatabaseTransaction* transaction,
+                                                     const char* serverIdentifier,
                                                      int32_t property)
   {
     DatabaseBackendAdapterV3::Transaction* t = reinterpret_cast<DatabaseBackendAdapterV3::Transaction*>(transaction);
@@ -1499,7 +1500,7 @@
       t->GetOutput().Clear();
 
       std::string s;
-      if (t->GetBackend().LookupGlobalProperty(s, property))
+      if (t->GetBackend().LookupGlobalProperty(s, serverIdentifier, property))
       {
         t->GetOutput().AnswerString(s);
       }
@@ -1683,6 +1684,7 @@
 
     
   static OrthancPluginErrorCode SetGlobalProperty(OrthancPluginDatabaseTransaction* transaction,
+                                                  const char* serverIdentifier,
                                                   int32_t property,
                                                   const char* value)
   {
@@ -1691,7 +1693,7 @@
     try
     {
       t->GetOutput().Clear();
-      t->GetBackend().SetGlobalProperty(property, value);
+      t->GetBackend().SetGlobalProperty(serverIdentifier, property, value);
       return OrthancPluginErrorCode_Success;
     }
     ORTHANC_PLUGINS_DATABASE_CATCH(t->GetContext());
--- a/Framework/Plugins/GlobalProperties.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/GlobalProperties.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -34,6 +34,7 @@
   bool LookupGlobalProperty(std::string& target,
                             IDatabase& db,
                             ITransaction& transaction,
+                            const std::string& serverIdentifier,
                             Orthanc::GlobalProperty property)
   {
     Query query("SELECT value FROM GlobalProperties WHERE property=${property}", true);
@@ -73,6 +74,7 @@
 
   bool LookupGlobalProperty(std::string& target /* out */,
                             DatabaseManager& manager,
+                            const std::string& serverIdentifier,
                             Orthanc::GlobalProperty property)
   {
     DatabaseManager::CachedStatement statement(
@@ -113,6 +115,7 @@
 
   void SetGlobalProperty(IDatabase& db,
                          ITransaction& transaction,
+                         const std::string& serverIdentifier,
                          Orthanc::GlobalProperty property,
                          const std::string& utf8)
   {
@@ -168,6 +171,7 @@
 
 
   void SetGlobalProperty(DatabaseManager& manager,
+                         const std::string& serverIdentifier,
                          Orthanc::GlobalProperty property,
                          const std::string& utf8)
   {
@@ -227,11 +231,12 @@
   bool LookupGlobalIntegerProperty(int& target,
                                    IDatabase& db,
                                    ITransaction& transaction,
+                                   const std::string& serverIdentifier,
                                    Orthanc::GlobalProperty property)
   {
     std::string value;
 
-    if (LookupGlobalProperty(value, db, transaction, property))
+    if (LookupGlobalProperty(value, db, transaction, serverIdentifier, property))
     {
       try
       {
@@ -253,9 +258,10 @@
 
   void SetGlobalIntegerProperty(IDatabase& db,
                                 ITransaction& transaction,
+                                const std::string& serverIdentifier,
                                 Orthanc::GlobalProperty property,
                                 int value)
   {
-    SetGlobalProperty(db, transaction, property, boost::lexical_cast<std::string>(value));
+    SetGlobalProperty(db, transaction, serverIdentifier, property, boost::lexical_cast<std::string>(value));
   }
 }
--- a/Framework/Plugins/GlobalProperties.h	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/GlobalProperties.h	Tue Mar 30 10:40:34 2021 +0200
@@ -23,6 +23,8 @@
 
 #include "../Common/DatabaseManager.h"
 
+#define MISSING_SERVER_IDENTIFIER ""
+
 
 namespace Orthanc
 {
@@ -63,28 +65,34 @@
   bool LookupGlobalProperty(std::string& target /* out */,
                             IDatabase& db,
                             ITransaction& transaction,
+                            const std::string& serverIdentifier,
                             Orthanc::GlobalProperty property);
 
   bool LookupGlobalProperty(std::string& target /* out */,
                             DatabaseManager& manager,
+                            const std::string& serverIdentifier,
                             Orthanc::GlobalProperty property);
 
   void SetGlobalProperty(IDatabase& db,
                          ITransaction& transaction,
+                         const std::string& serverIdentifier,
                          Orthanc::GlobalProperty property,
                          const std::string& utf8);
 
   void SetGlobalProperty(DatabaseManager& manager,
+                         const std::string& serverIdentifier,
                          Orthanc::GlobalProperty property,
                          const std::string& utf8);
 
   bool LookupGlobalIntegerProperty(int& target,
                                    IDatabase& db,
                                    ITransaction& transaction,
+                                   const std::string& serverIdentifier,
                                    Orthanc::GlobalProperty property);
 
   void SetGlobalIntegerProperty(IDatabase& db,
                                 ITransaction& transaction,
+                                const std::string& serverIdentifier,
                                 Orthanc::GlobalProperty property,
                                 int value);
 }
--- a/Framework/Plugins/IDatabaseBackend.h	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/IDatabaseBackend.h	Tue Mar 30 10:40:34 2021 +0200
@@ -141,6 +141,7 @@
                                   int32_t contentType) = 0;
 
     virtual bool LookupGlobalProperty(std::string& target /*out*/,
+                                      const char* serverIdentifier,
                                       int32_t property) = 0;
 
     virtual void LookupIdentifier(std::list<int64_t>& target /*out*/,
@@ -173,7 +174,8 @@
     virtual bool SelectPatientToRecycle(int64_t& internalId /*out*/,
                                         int64_t patientIdToAvoid) = 0;
 
-    virtual void SetGlobalProperty(int32_t property,
+    virtual void SetGlobalProperty(const char* serverIdentifier,
+                                   int32_t property,
                                    const char* value) = 0;
 
     virtual void SetMainDicomTag(int64_t id,
--- a/Framework/Plugins/IndexBackend.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -1034,9 +1034,11 @@
 
     
   bool IndexBackend::LookupGlobalProperty(std::string& target /*out*/,
+                                          const char* serverIdentifier,
                                           int32_t property)
   {
-    return ::OrthancDatabases::LookupGlobalProperty(target, manager_, static_cast<Orthanc::GlobalProperty>(property));
+    return ::OrthancDatabases::LookupGlobalProperty(target, manager_, serverIdentifier,
+                                                    static_cast<Orthanc::GlobalProperty>(property));
   }
 
     
@@ -1289,10 +1291,12 @@
   }
 
     
-  void IndexBackend::SetGlobalProperty(int32_t property,
+  void IndexBackend::SetGlobalProperty(const char* serverIdentifier,
+                                       int32_t property,
                                        const char* value)
   {
-    return ::OrthancDatabases::SetGlobalProperty(manager_, static_cast<Orthanc::GlobalProperty>(property), value);
+    return ::OrthancDatabases::SetGlobalProperty(
+      manager_, serverIdentifier, static_cast<Orthanc::GlobalProperty>(property), value);
   }
 
 
@@ -1446,7 +1450,7 @@
     
     std::string version = "unknown";
       
-    if (LookupGlobalProperty(version, Orthanc::GlobalProperty_DatabaseSchemaVersion))
+    if (LookupGlobalProperty(version, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion))
     {
       try
       {
--- a/Framework/Plugins/IndexBackend.h	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/IndexBackend.h	Tue Mar 30 10:40:34 2021 +0200
@@ -193,6 +193,7 @@
                                   int32_t contentType) ORTHANC_OVERRIDE;
     
     virtual bool LookupGlobalProperty(std::string& target /*out*/,
+                                      const char* serverIdentifier,
                                       int32_t property) ORTHANC_OVERRIDE;
     
     virtual void LookupIdentifier(std::list<int64_t>& target /*out*/,
@@ -225,7 +226,8 @@
     virtual bool SelectPatientToRecycle(int64_t& internalId /*out*/,
                                         int64_t patientIdToAvoid) ORTHANC_OVERRIDE;
     
-    virtual void SetGlobalProperty(int32_t property,
+    virtual void SetGlobalProperty(const char* serverIdentifier,
+                                   int32_t property,
                                    const char* value) ORTHANC_OVERRIDE;
 
     virtual void SetMainDicomTag(int64_t id,
--- a/Framework/Plugins/IndexUnitTests.h	Mon Mar 29 16:39:20 2021 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Tue Mar 30 10:40:34 2021 +0200
@@ -187,15 +187,15 @@
   
 
   std::string s;
-  ASSERT_TRUE(db.LookupGlobalProperty(s, Orthanc::GlobalProperty_DatabaseSchemaVersion));
+  ASSERT_TRUE(db.LookupGlobalProperty(s, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion));
   ASSERT_EQ("6", s);
 
-  ASSERT_FALSE(db.LookupGlobalProperty(s, Orthanc::GlobalProperty_AnonymizationSequence));
-  db.SetGlobalProperty(Orthanc::GlobalProperty_AnonymizationSequence, "Hello");
-  ASSERT_TRUE(db.LookupGlobalProperty(s, Orthanc::GlobalProperty_AnonymizationSequence));
+  ASSERT_FALSE(db.LookupGlobalProperty(s, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_AnonymizationSequence));
+  db.SetGlobalProperty(MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_AnonymizationSequence, "Hello");
+  ASSERT_TRUE(db.LookupGlobalProperty(s, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_AnonymizationSequence));
   ASSERT_EQ("Hello", s);
-  db.SetGlobalProperty(Orthanc::GlobalProperty_AnonymizationSequence, "HelloWorld");
-  ASSERT_TRUE(db.LookupGlobalProperty(s, Orthanc::GlobalProperty_AnonymizationSequence));
+  db.SetGlobalProperty(MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_AnonymizationSequence, "HelloWorld");
+  ASSERT_TRUE(db.LookupGlobalProperty(s, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_AnonymizationSequence));
   ASSERT_EQ("HelloWorld", s);
 
   int64_t a = db.CreateResource("study", OrthancPluginResourceType_Study);
--- a/MySQL/Plugins/MySQLIndex.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/MySQL/Plugins/MySQLIndex.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -141,10 +141,10 @@
           ThrowCannotCreateTrigger();
         }
 
-        if (!LookupGlobalIntegerProperty(version, *db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion))
+        if (!LookupGlobalIntegerProperty(version, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion))
         {
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
           version = expectedVersion;
         }
 
@@ -162,10 +162,10 @@
       {
         MySQLTransaction t(*db, TransactionType_ReadWrite);
 
-        if (!LookupGlobalIntegerProperty(revision, *db, t, Orthanc::GlobalProperty_DatabasePatchLevel))
+        if (!LookupGlobalIntegerProperty(revision, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel))
         {
           revision = 1;
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
         }
 
         t.Commit();
@@ -182,7 +182,7 @@
         db->Execute("ALTER TABLE GlobalProperties MODIFY value LONGTEXT", false);
         
         revision = 2;
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
 
         t.Commit();
       }
@@ -204,7 +204,7 @@
         }
         
         revision = 3;
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
 
         t.Commit();
       }
@@ -221,7 +221,7 @@
         db->Execute("ALTER TABLE Metadata MODIFY value LONGTEXT", false);
         
         revision = 4;
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
 
         t.Commit();
       }
@@ -238,7 +238,7 @@
         db->Execute(query, true);
         
         revision = 5;
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
 
         t.Commit();
       }
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -91,9 +91,9 @@
             (query, Orthanc::EmbeddedResources::POSTGRESQL_PREPARE_INDEX);
           db->Execute(query);
 
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 0);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_HasTrigramIndex, 0);
         }
           
         if (!db->DoesTableExist("Resources"))
@@ -103,7 +103,7 @@
         }
 
         int version = 0;
-        if (!LookupGlobalIntegerProperty(version, *db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion) ||
+        if (!LookupGlobalIntegerProperty(version, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion) ||
             version != 6)
         {
           LOG(ERROR) << "PostgreSQL plugin is incompatible with database schema version: " << version;
@@ -111,10 +111,10 @@
         }
 
         int revision;
-        if (!LookupGlobalIntegerProperty(revision, *db, t, Orthanc::GlobalProperty_DatabasePatchLevel))
+        if (!LookupGlobalIntegerProperty(revision, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel))
         {
           revision = 1;
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
         }
 
         if (revision != 1)
@@ -130,7 +130,7 @@
         PostgreSQLTransaction t(*db, TransactionType_ReadWrite);
 
         int hasTrigram = 0;
-        if (!LookupGlobalIntegerProperty(hasTrigram, *db, t,
+        if (!LookupGlobalIntegerProperty(hasTrigram, *db, t, MISSING_SERVER_IDENTIFIER,
                                          Orthanc::GlobalProperty_HasTrigramIndex) ||
             hasTrigram != 1)
         {
@@ -154,7 +154,7 @@
               "CREATE EXTENSION IF NOT EXISTS pg_trgm; "
               "CREATE INDEX DicomIdentifiersIndexValues2 ON DicomIdentifiers USING gin(value gin_trgm_ops);");
 
-            SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 1);
+            SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_HasTrigramIndex, 1);
             LOG(WARNING) << "Trigram index has been created";
 
             t.Commit();
@@ -177,7 +177,7 @@
         PostgreSQLTransaction t(*db, TransactionType_ReadWrite);
 
         int property = 0;
-        if (!LookupGlobalIntegerProperty(property, *db, t,
+        if (!LookupGlobalIntegerProperty(property, *db, t, MISSING_SERVER_IDENTIFIER,
                                          Orthanc::GlobalProperty_HasCreateInstance) ||
             property != 2)
         {
@@ -195,11 +195,11 @@
             (query, Orthanc::EmbeddedResources::POSTGRESQL_CREATE_INSTANCE);
           db->Execute(query);
 
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasCreateInstance, 2);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_HasCreateInstance, 2);
         }
 
       
-        if (!LookupGlobalIntegerProperty(property, *db, t,
+        if (!LookupGlobalIntegerProperty(property, *db, t, MISSING_SERVER_IDENTIFIER,
                                          Orthanc::GlobalProperty_GetTotalSizeIsFast) ||
             property != 1)
         {
@@ -210,14 +210,14 @@
             (query, Orthanc::EmbeddedResources::POSTGRESQL_FAST_TOTAL_SIZE);
           db->Execute(query);
 
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_GetTotalSizeIsFast, 1);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_GetTotalSizeIsFast, 1);
         }
 
 
         // Installing this extension requires the "GlobalIntegers" table
         // created by the "FastTotalSize" extension
         property = 0;
-        if (!LookupGlobalIntegerProperty(property, *db, t,
+        if (!LookupGlobalIntegerProperty(property, *db, t, MISSING_SERVER_IDENTIFIER,
                                          Orthanc::GlobalProperty_HasFastCountResources) ||
             property != 1)
         {
@@ -228,14 +228,14 @@
             (query, Orthanc::EmbeddedResources::POSTGRESQL_FAST_COUNT_RESOURCES);
           db->Execute(query);
 
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasFastCountResources, 1);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_HasFastCountResources, 1);
         }
 
 
         // Installing this extension requires the "GlobalIntegers" table
         // created by the "GetLastChangeIndex" extension
         property = 0;
-        if (!LookupGlobalIntegerProperty(property, *db, t,
+        if (!LookupGlobalIntegerProperty(property, *db, t, MISSING_SERVER_IDENTIFIER,
                                          Orthanc::GlobalProperty_GetLastChangeIndex) ||
             property != 1)
         {
@@ -246,7 +246,7 @@
             (query, Orthanc::EmbeddedResources::POSTGRESQL_GET_LAST_CHANGE_INDEX);
           db->Execute(query);
 
-          SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_GetLastChangeIndex, 1);
+          SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_GetLastChangeIndex, 1);
         }
 
         t.Commit();
--- a/PostgreSQL/UnitTests/PostgreSQLTests.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/PostgreSQL/UnitTests/PostgreSQLTests.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -458,7 +458,7 @@
   db.Open();
 
   std::string s;
-  ASSERT_TRUE(db.LookupGlobalProperty(s, Orthanc::GlobalProperty_DatabaseInternal1));
+  ASSERT_TRUE(db.LookupGlobalProperty(s, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal1));
   ASSERT_EQ("2", s);
 
   OrthancPluginCreateInstanceResult r1, r2;
--- a/SQLite/Plugins/SQLiteIndex.cpp	Mon Mar 29 16:39:20 2021 +0200
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Tue Mar 30 10:40:34 2021 +0200
@@ -75,8 +75,8 @@
           (query, Orthanc::EmbeddedResources::SQLITE_PREPARE_INDEX);
         db->Execute(query);
  
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, 1);
      }
           
       t.Commit();
@@ -105,7 +105,7 @@
       }
 
       int version = 0;
-      if (!LookupGlobalIntegerProperty(version, *db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion) ||
+      if (!LookupGlobalIntegerProperty(version, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion) ||
           version != 6)
       {
         LOG(ERROR) << "SQLite plugin is incompatible with database schema version: " << version;
@@ -113,10 +113,10 @@
       }
 
       int revision;
-      if (!LookupGlobalIntegerProperty(revision, *db, t, Orthanc::GlobalProperty_DatabasePatchLevel))
+      if (!LookupGlobalIntegerProperty(revision, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel))
       {
         revision = 1;
-        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+        SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
       }
 
       if (revision != 1)