diff options
Diffstat (limited to 'src/schema.c')
-rw-r--r-- | src/schema.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/schema.c b/src/schema.c index fd1d573..f7fceae 100644 --- a/src/schema.c +++ b/src/schema.c @@ -434,6 +434,36 @@ static int og_dbi_schema_v10(struct og_dbi *dbi) return 0; } +static int og_dbi_schema_v11(struct og_dbi *dbi) +{ + const char *msglog; + dbi_result result; + + syslog(LOG_DEBUG, "Adding free_size and used_size to ordenadores_particiones\n"); + result = dbi_conn_query(dbi->conn, + "ALTER TABLE `ordenadores_particiones` " + "ADD `used_size` BIGINT DEFAULT '0' AFTER `cache`, " + "ADD `free_size` BIGINT DEFAULT '0' AFTER `used_size`;"); + if (!result) { + dbi_conn_error(dbi->conn, &msglog); + syslog(LOG_INFO, "Error when updating ordenadores_particiones table (%s:%d) %s\n", + __func__, __LINE__, msglog); + return -1; + } + dbi_result_free(result); + + result = dbi_conn_query(dbi->conn, "UPDATE version SET version = 11"); + 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); @@ -448,6 +478,7 @@ static struct og_schema_version { { .version = 8, .update = og_dbi_schema_v8, }, { .version = 9, .update = og_dbi_schema_v9, }, { .version = 10, .update = og_dbi_schema_v10,}, + { .version = 11, .update = og_dbi_schema_v11,}, { 0, NULL }, }; |