Only backup database if schema version is correct
This commit is contained in:
@@ -519,11 +519,13 @@ void Database::DoBackup() {
|
|||||||
|
|
||||||
QSqlDatabase db(this->Connect());
|
QSqlDatabase db(this->Connect());
|
||||||
|
|
||||||
|
if (!db.isOpen()) return;
|
||||||
|
|
||||||
// Before we overwrite anything, make sure the database is not corrupt
|
// Before we overwrite anything, make sure the database is not corrupt
|
||||||
QMutexLocker l(&mutex_);
|
QMutexLocker l(&mutex_);
|
||||||
const bool ok = IntegrityCheck(db);
|
|
||||||
|
|
||||||
if (ok) {
|
const bool ok = IntegrityCheck(db);
|
||||||
|
if (ok && SchemaVersion(&db) == kSchemaVersion) {
|
||||||
BackupFile(db.databaseName());
|
BackupFile(db.databaseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user