From 6a73a9c405473725ae7d7159e1f88ad54c10448c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 28 Feb 2018 13:52:57 +0100 Subject: Fixed and tested the upgrade from a database without version. --- common/store.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'common') diff --git a/common/store.cpp b/common/store.cpp index ad2bb1c..34d547b 100644 --- a/common/store.cpp +++ b/common/store.cpp @@ -327,8 +327,7 @@ KAsync::Job Store::removeDataFromDisk(const QByteArray &identifier) static KAsync::Job upgrade(const QByteArray &resource) { auto store = Sink::Storage::DataStore(Sink::storageLocation(), resource, Sink::Storage::DataStore::ReadOnly); - const auto version = Storage::DataStore::databaseVersion(store.createTransaction(Storage::DataStore::ReadOnly)); - if (version == Sink::latestDatabaseVersion() || version == 0) { + if (!store.exists() || Storage::DataStore::databaseVersion(store.createTransaction(Storage::DataStore::ReadOnly)) == Sink::latestDatabaseVersion()) { return KAsync::value(Store::UpgradeResult{false}); } SinkLog() << "Upgrading " << resource; -- cgit v1.2.3