diff options
Diffstat (limited to 'src/schema.c')
-rw-r--r-- | src/schema.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/schema.c b/src/schema.c index 1c2428c..acc5468 100644 --- a/src/schema.c +++ b/src/schema.c @@ -497,6 +497,42 @@ static int og_dbi_schema_v12(struct og_dbi *dbi) return 0; } +static int og_dbi_schema_v13(struct og_dbi *dbi) +{ + const char *msglog; + dbi_result result; + + syslog(LOG_DEBUG, "Updating table oglive\n"); + result = dbi_conn_query(dbi->conn, "ALTER TABLE `oglive` DROP COLUMN `is_default`"); + if (!result) { + dbi_conn_error(dbi->conn, &msglog); + syslog(LOG_INFO, "Error deleting column is_default in oglive table (%s:%d) %s\n", + __func__, __LINE__, msglog); + return -1; + } + dbi_result_free(result); + + result = dbi_conn_query(dbi->conn, "ALTER TABLE `oglive` ADD COLUMN `priority` INT NOT NULL DEFAULT 0"); + if (!result) { + dbi_conn_error(dbi->conn, &msglog); + syslog(LOG_INFO, "Error adding column priority to oglive table (%s:%d) %s\n", + __func__, __LINE__, msglog); + return -1; + } + dbi_result_free(result); + + result = dbi_conn_query(dbi->conn, "UPDATE version SET version = 13"); + 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); @@ -513,6 +549,7 @@ static struct og_schema_version { { .version = 10, .update = og_dbi_schema_v10,}, { .version = 11, .update = og_dbi_schema_v11,}, { .version = 12, .update = og_dbi_schema_v12,}, + { .version = 13, .update = og_dbi_schema_v13,}, { 0, NULL }, }; |