data: Store separate storage version number in SqliteStorage for managing migrations

* deprecated the third version number as storage update number
* version can now have either 3 or 4 numbers
* whether a .coatidb file is outdated is now solely determined by the SqliteStorage::STORAGE_VERSION
This commit is contained in:
Eberhard Graether
2016-07-20 14:14:21 +02:00
parent eb8808b624
commit cb869c2465
8 changed files with 103 additions and 78 deletions
+12 -3
View File
@@ -24,7 +24,6 @@ public:
SqliteStorage(const FilePath& dbFilePath);
~SqliteStorage();
void init();
void setup();
void clear();
@@ -34,8 +33,10 @@ public:
FilePath getDbFilePath() const;
Version getVersion() const;
void setVersion(const Version& version);
bool isEmpty() const;
bool isIncompatible() const;
void setVersion();
Id addEdge(int type, Id sourceNodeId, Id targetNodeId);
Id addNode(int type, const std::string& serializedName, int definitionType);
@@ -118,6 +119,8 @@ public:
int getSourceLocationCount() const;
private:
static const size_t STORAGE_VERSION;
void clearTables();
void setupTables();
@@ -126,6 +129,12 @@ private:
std::string getMetaValue(const std::string& key) const;
void insertOrUpdateMetaValue(const std::string& key, const std::string& value);
size_t getStorageVersion() const;
void setStorageVersion();
Version getApplicationVersion() const;
void setApplicationVersion();
template <typename ResultType>
std::vector<ResultType> getAll(const std::string& query) const;