diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2023-12-12 16:49:25 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2023-12-12 17:02:44 +0100 |
commit | ee09056908bc925d018a5466629872434ac3edf6 (patch) | |
tree | 92866106311664e5e0558e83dc9ac101dc3c6cec /src/schema.c | |
parent | e3b8f3d2f9ea5f1b3ea68c4d5ba862680f7851fa (diff) |
client: parse permissions and lastupdate in /image/create response from clientv1.2.5-5
Use permissions and last update from client.
update src/schema.c to add a new database version.
Diffstat (limited to 'src/schema.c')
-rw-r--r-- | src/schema.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/schema.c b/src/schema.c index d31046e..f1fab5b 100644 --- a/src/schema.c +++ b/src/schema.c @@ -240,6 +240,37 @@ static int og_dbi_schema_v4(struct og_dbi *dbi) return 0; } +static int og_dbi_schema_v5(struct og_dbi *dbi) +{ + const char *msglog; + dbi_result result; + + syslog(LOG_DEBUG, "Adding size, lastupdate and permissions to imagenes\n"); + result = dbi_conn_query(dbi->conn, + "ALTER TABLE `imagenes` " + "ADD `size` bigint DEFAULT '0' AFTER `datasize`, " + "ADD `lastupdate` bigint DEFAULT '0' AFTER `size`, " + "ADD `permissions` int DEFAULT '0' AFTER `lastupdate`;"); + 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 = 5"); + 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); @@ -248,6 +279,7 @@ static struct og_schema_version { { .version = 2, .update = og_dbi_schema_v2 }, { .version = 3, .update = og_dbi_schema_v3 }, { .version = 4, .update = og_dbi_schema_v4 }, + { .version = 5, .update = og_dbi_schema_v5 }, { 0, NULL }, }; |