diff --git a/YACReaderLibrary/db/data_base_management.cpp b/YACReaderLibrary/db/data_base_management.cpp index 4cf89ac3..5f6d9901 100644 --- a/YACReaderLibrary/db/data_base_management.cpp +++ b/YACReaderLibrary/db/data_base_management.cpp @@ -169,7 +169,7 @@ bool DataBaseManagement::createTables(QSqlDatabase & database) "hash TEXT UNIQUE NOT NULL," "edited BOOLEAN DEFAULT 0," "read BOOLEAN DEFAULT 0," -//now 7.0 fields +//new 7.0 fields "hasBeenOpened BOOLEAN DEFAULT 0," "rating INTEGER DEFAULT 0," @@ -551,9 +551,13 @@ int DataBaseManagement::compareVersions(const QString & v1, const QString v2) bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath) { + bool pre7 = false; + if(compareVersions(DataBaseManagement::checkValidDB(fullPath),"7.0.0")<0) + pre7 = true; + QSqlDatabase db = loadDatabaseFromFile(fullPath); bool returnValue = false; - if(db.isValid() && db.isOpen()) + if(db.isValid() && db.isOpen()) { QSqlQuery updateVersion(db); updateVersion.prepare("UPDATE db_info SET " @@ -562,8 +566,9 @@ bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath) updateVersion.exec(); if(updateVersion.numRowsAffected() > 0) - returnValue = true; - if(returnValue) //TODO: execute only if previous version was < 7.0 + returnValue = true; + + if(pre7) //TODO: execute only if previous version was < 7.0 { //new 7.0 fields QStringList columnDefs; @@ -629,4 +634,4 @@ void ComicsInfoImporter::importComicsInfo(QSqlDatabase & source, QSqlDatabase & void ComicsInfoImporter::run() { -} \ No newline at end of file +} diff --git a/common/yacreader_global.h b/common/yacreader_global.h index fd957b4d..1b5c7b27 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -8,7 +8,7 @@ #endif -#define VERSION "6.5.3" +#define VERSION "7.0.0" #define PATH "PATH" #define MAG_GLASS_SIZE "MAG_GLASS_SIZE"