summaryrefslogtreecommitdiffstats
path: root/src/schema.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/schema.c')
-rw-r--r--src/schema.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/schema.c b/src/schema.c
index d5a2269..002fd56 100644
--- a/src/schema.c
+++ b/src/schema.c
@@ -306,6 +306,35 @@ static int og_dbi_schema_v6(struct og_dbi *dbi)
return 0;
}
+static int og_dbi_schema_v7(struct og_dbi *dbi)
+{
+ const char *msglog;
+ dbi_result result;
+
+ syslog(LOG_DEBUG, "Adding checksum to imagenes\n");
+ result = dbi_conn_query(dbi->conn,
+ "ALTER TABLE `imagenes` "
+ "ADD `checksum` varchar(128) NOT NULL DEFAULT ''");
+ if (!result) {
+ dbi_conn_error(dbi->conn, &msglog);
+ syslog(LOG_INFO, "Error when adding checksum (%s:%d) %s\n",
+ __func__, __LINE__, msglog);
+ return -1;
+ }
+ dbi_result_free(result);
+
+ result = dbi_conn_query(dbi->conn, "UPDATE version SET version = 7");
+ 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);
@@ -316,6 +345,7 @@ static struct og_schema_version {
{ .version = 4, .update = og_dbi_schema_v4 },
{ .version = 5, .update = og_dbi_schema_v5 },
{ .version = 6, .update = og_dbi_schema_v6 },
+ { .version = 7, .update = og_dbi_schema_v7, },
{ 0, NULL },
};