Commit 946410de authored by Fabio Bas's avatar Fabio Bas
Browse files

Fix misleading error message in servatrice; fix #1275

parent 0d5e1696
...@@ -69,10 +69,13 @@ bool Servatrice_DatabaseInterface::openDatabase() ...@@ -69,10 +69,13 @@ bool Servatrice_DatabaseInterface::openDatabase()
if (versionQuery->next()) { if (versionQuery->next()) {
const int dbversion = versionQuery->value(0).toInt(); const int dbversion = versionQuery->value(0).toInt();
const int expectedversion = DATABASE_SCHEMA_VERSION; const int expectedversion = DATABASE_SCHEMA_VERSION;
if(dbversion != expectedversion) if(dbversion < expectedversion)
{ {
qCritical() << QString("[%1] Error opening database: the database schema version is too old, you need to run the migrations to update it from version %2 to version %3").arg(poolStr).arg(dbversion).arg(expectedversion); qCritical() << QString("[%1] Error opening database: the database schema version is too old, you need to run the migrations to update it from version %2 to version %3").arg(poolStr).arg(dbversion).arg(expectedversion);
return false; return false;
} else if(dbversion > expectedversion) {
qCritical() << QString("[%1] Error opening database: the database schema version %2 is too new, you need to update servatrice (this servatrice actually uses version %3)").arg(poolStr).arg(dbversion).arg(expectedversion);
return false;
} }
} else { } else {
qCritical() << QString("[%1] Error opening database: unable to load database schema version (hint: ensure the cockatrice_schema_version contains a single record)").arg(poolStr); qCritical() << QString("[%1] Error opening database: unable to load database schema version (hint: ensure the cockatrice_schema_version contains a single record)").arg(poolStr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment