diff OrthancServer/DatabaseWrapper.cpp @ 1407:d371a66972a4

OrthancPluginGetExpectedDatabaseVersion
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jun 2015 10:19:13 +0200
parents 5fe254fb1c93
children 0ac74fa21db8
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Tue Jun 02 17:48:13 2015 +0200
+++ b/OrthancServer/DatabaseWrapper.cpp	Wed Jun 03 10:19:13 2015 +0200
@@ -796,15 +796,6 @@
       LOG(INFO) << "Version of the Orthanc database: " << version;
       unsigned int v = boost::lexical_cast<unsigned int>(version);
 
-      /**
-       * History of the database versions:
-       *  - Orthanc before Orthanc 0.3.0 (inclusive) had no version
-       *  - Version 2: only Orthanc 0.3.1
-       *  - Version 3: from Orthanc 0.3.2 to Orthanc 0.7.2 (inclusive)
-       *  - Version 4: from Orthanc 0.7.3 to Orthanc 0.8.4 (inclusive)
-       *  - Version 5: from Orthanc 0.8.5 (inclusive)
-       **/
-
       // This version of Orthanc is only compatible with versions 3, 4 and 5 of the DB schema
       ok = (v == 3 || v == 4 || v == 5);
 
@@ -821,6 +812,12 @@
         UpgradeDatabase(db_, EmbeddedResources::UPGRADE_DATABASE_4_TO_5);
         v = 5;
       }
+
+      // Sanity check
+      if (ORTHANC_DATABASE_VERSION != v)
+      {
+        throw OrthancException(ErrorCode_InternalError);
+      }
     }
     catch (boost::bad_lexical_cast&)
     {