Merge pull request #1287 from ctrlaltca/servatrice_db_version

Fix misleading error message in servatrice; fix #1275
This commit is contained in:
Zach 2015-07-25 22:36:01 -07:00
commit f3ee1eac12

View file

@ -69,10 +69,13 @@ bool Servatrice_DatabaseInterface::openDatabase()
if (versionQuery->next()) {
const int dbversion = versionQuery->value(0).toInt();
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);
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 {
qCritical() << QString("[%1] Error opening database: unable to load database schema version (hint: ensure the cockatrice_schema_version contains a single record)").arg(poolStr);