QSqlQuery*versionQuery=prepareQuery("select version from {prefix}_schema_version limit 1");
if(!execSqlQuery(versionQuery)){
qCritical()<<QString("[%1] Error opening database: unable to load database schema version (hint: ensure the cockatrice_schema_version exists)").arg(poolStr);
returnfalse;
}
if(versionQuery->next()){
constintdbversion=versionQuery->value(0).toInt();
constintexpectedversion=DATABASE_SCHEMA_VERSION;
if(dbversion!=expectedversion)
{
qCritical()<<QString("[%1] Error opening database: the database schema version is too old, yum need to run the migrations to update it from version %2 to version %3").arg(poolStr).arg(dbversion).arg(expectedversion);
returnfalse;
}
}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);