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