summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton <anton@picapica>2016-08-30 21:55:10 +0400
committerAnton <anton@picapica>2016-08-30 21:55:10 +0400
commitd2991d30b0062bfd2ad3ae272ccac8acf7a4997d (patch)
tree78822437f5ae35ea31b31c4f09a967797822759b
parentbd74b5f2aef6e43a8060cfa1dd214f6797718008 (diff)
downloadpica-pica-d2991d30b0062bfd2ad3ae272ccac8acf7a4997d.tar.gz
pica-pica-d2991d30b0062bfd2ad3ae272ccac8acf7a4997d.zip
added sqlite table settings and updated schema version
-rw-r--r--pica-client/main.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/pica-client/main.cpp b/pica-client/main.cpp
index 7df81ce..fcfa3c1 100644
--- a/pica-client/main.cpp
+++ b/pica-client/main.cpp
@@ -135,7 +135,17 @@ static bool create_database()
if (query.lastError().isValid())
goto showerror;
- query.exec("insert into schema_version values (2, strftime('%s','now'));"); //current schema version. update when needed
+ query.exec("create table settings \
+ ( \
+ name varchar(255) not null, \
+ value varchar(255) not null \
+ );"
+ );
+
+ if (query.lastError().isValid())
+ goto showerror;
+
+ query.exec("insert into schema_version values (3, strftime('%s','now'));"); //current schema version. update when needed
if (query.lastError().isValid())
showerror:
@@ -363,6 +373,21 @@ static bool update_database()
schema_ver = 2;
}
+ if (schema_ver == 2)
+ {
+ query.exec("create table settings \
+ ( \
+ name varchar(255) not null, \
+ value varchar(255) not null \
+ );"
+ );
+
+ if (query.lastError().isValid())
+ goto showerror;
+
+ schema_ver = 3;
+ }
+
if (query.lastError().isValid())
showerror:
{