summaryrefslogtreecommitdiffstats
path: root/common/storage/entitystore.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-26 13:33:17 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-26 13:33:17 +0200
commit29f80e6e4d698217933b7bd2df90c08162416d3f (patch)
tree324c496b016b694a3ee963e7ff29d21dcc36426c /common/storage/entitystore.cpp
parenta9c40f85cf9487ab684c35d564a603e28ae63066 (diff)
downloadsink-29f80e6e4d698217933b7bd2df90c08162416d3f.tar.gz
sink-29f80e6e4d698217933b7bd2df90c08162416d3f.zip
Don't just set the db version, only when we create the db first.
Diffstat (limited to 'common/storage/entitystore.cpp')
-rw-r--r--common/storage/entitystore.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp
index 7da7efa..6021344 100644
--- a/common/storage/entitystore.cpp
+++ b/common/storage/entitystore.cpp
@@ -158,6 +158,15 @@ EntityStore::EntityStore(const ResourceContext &context, const Log::Context &ctx
158 158
159} 159}
160 160
161void EntityStore::createIfMissing()
162{
163 if (!d->exists()) {
164 startTransaction(Sink::Storage::DataStore::ReadWrite);
165 Storage::DataStore::setDatabaseVersion(d->transaction, Sink::latestDatabaseVersion());
166 commitTransaction();
167 }
168}
169
161void EntityStore::startTransaction(Sink::Storage::DataStore::AccessMode accessMode) 170void EntityStore::startTransaction(Sink::Storage::DataStore::AccessMode accessMode)
162{ 171{
163 SinkTraceCtx(d->logCtx) << "Starting transaction: " << accessMode; 172 SinkTraceCtx(d->logCtx) << "Starting transaction: " << accessMode;