summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/schema.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/schema.c b/src/schema.c
index f1fab5b..d5a2269 100644
--- a/src/schema.c
+++ b/src/schema.c
@@ -271,6 +271,41 @@ static int og_dbi_schema_v5(struct og_dbi *dbi)
return 0;
}
+static int og_dbi_schema_v6(struct og_dbi *dbi)
+{
+ const char *msglog;
+ dbi_result result;
+
+ syslog(LOG_DEBUG, "create table cache\n");
+ result = dbi_conn_query(dbi->conn,
+ "CREATE TABLE `cache` ("
+ "`cacheid` int NOT NULL AUTO_INCREMENT,"
+ "`clientid` int NOT NULL DEFAULT 0,"
+ "`imagename` varchar(80) NOT NULL DEFAULT '',"
+ "`size` bigint NOT NULL DEFAULT 0,"
+ "`checksum` varchar(128) NOT NULL DEFAULT '',"
+ "PRIMARY KEY (`cacheid`)"
+ ") AUTO_INCREMENT=1;");
+ if (!result) {
+ dbi_conn_error(dbi->conn, &msglog);
+ syslog(LOG_INFO, "Error when adding identorno (%s:%d) %s\n",
+ __func__, __LINE__, msglog);
+ return -1;
+ }
+ dbi_result_free(result);
+
+ result = dbi_conn_query(dbi->conn, "UPDATE version SET version = 6");
+ if (!result) {
+ dbi_conn_error(dbi->conn, &msglog);
+ syslog(LOG_INFO, "Could not update version row (%s:%d) %s\n",
+ __func__, __LINE__, msglog);
+ return -1;
+ }
+ dbi_result_free(result);
+
+ return 0;
+}
+
static struct og_schema_version {
int version;
int (*update)(struct og_dbi *dbi);
@@ -280,6 +315,7 @@ static struct og_schema_version {
{ .version = 3, .update = og_dbi_schema_v3 },
{ .version = 4, .update = og_dbi_schema_v4 },
{ .version = 5, .update = og_dbi_schema_v5 },
+ { .version = 6, .update = og_dbi_schema_v6 },
{ 0, NULL },
};