Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 2955:bbfd95a0c429
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Dec 2018 14:59:23 +0100 |
parents | 4ceb9bf7b00c |
children | e3b5c07146a3 8b331be57606 |
comparison
equal
deleted
inserted
replaced
2954:d924f9bb61cc | 2955:bbfd95a0c429 |
---|---|
1001 return; | 1001 return; |
1002 } | 1002 } |
1003 | 1003 |
1004 if (currentVersion > ORTHANC_DATABASE_VERSION) | 1004 if (currentVersion > ORTHANC_DATABASE_VERSION) |
1005 { | 1005 { |
1006 LOG(ERROR) << "The version of the database schema (" << currentVersion | 1006 throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, |
1007 << ") is too recent for this version of Orthanc. Please upgrade Orthanc."; | 1007 "The version of the database schema (" + |
1008 throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); | 1008 boost::lexical_cast<std::string>(currentVersion) + |
1009 ") is too recent for this version of Orthanc. Please upgrade Orthanc."); | |
1009 } | 1010 } |
1010 | 1011 |
1011 LOG(WARNING) << "Upgrading the database from schema version " | 1012 LOG(WARNING) << "Upgrading the database from schema version " |
1012 << currentVersion << " to " << ORTHANC_DATABASE_VERSION; | 1013 << currentVersion << " to " << ORTHANC_DATABASE_VERSION; |
1013 | 1014 |
1024 | 1025 |
1025 // Sanity check | 1026 // Sanity check |
1026 currentVersion = database.GetDatabaseVersion(); | 1027 currentVersion = database.GetDatabaseVersion(); |
1027 if (ORTHANC_DATABASE_VERSION != currentVersion) | 1028 if (ORTHANC_DATABASE_VERSION != currentVersion) |
1028 { | 1029 { |
1029 LOG(ERROR) << "The database schema was not properly upgraded, it is still at version " << currentVersion; | 1030 throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, |
1030 throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); | 1031 "The database schema was not properly upgraded, it is still at version " + |
1032 boost::lexical_cast<std::string>(currentVersion)); | |
1031 } | 1033 } |
1032 else | 1034 else |
1033 { | 1035 { |
1034 LOG(WARNING) << "The database schema was successfully upgraded, " | 1036 LOG(WARNING) << "The database schema was successfully upgraded, " |
1035 << "you can now start Orthanc without the \"--upgrade\" argument"; | 1037 << "you can now start Orthanc without the \"--upgrade\" argument"; |
1169 UpgradeDatabase(database, storageArea); | 1171 UpgradeDatabase(database, storageArea); |
1170 return false; // Stop and don't restart Orthanc (cf. issue 29) | 1172 return false; // Stop and don't restart Orthanc (cf. issue 29) |
1171 } | 1173 } |
1172 else if (currentVersion != ORTHANC_DATABASE_VERSION) | 1174 else if (currentVersion != ORTHANC_DATABASE_VERSION) |
1173 { | 1175 { |
1174 LOG(ERROR) << "The database schema must be changed from version " | 1176 throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, |
1175 << currentVersion << " to " << ORTHANC_DATABASE_VERSION | 1177 "The database schema must be changed from version " + |
1176 << ": Please run Orthanc with the \"--upgrade\" argument"; | 1178 boost::lexical_cast<std::string>(currentVersion) + " to " + |
1177 throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); | 1179 boost::lexical_cast<std::string>(ORTHANC_DATABASE_VERSION) + |
1180 ": Please run Orthanc with the \"--upgrade\" argument"); | |
1178 } | 1181 } |
1179 | 1182 |
1180 bool success = ConfigureServerContext | 1183 bool success = ConfigureServerContext |
1181 (database, storageArea, plugins, loadJobsFromDatabase); | 1184 (database, storageArea, plugins, loadJobsFromDatabase); |
1182 | 1185 |