From bfa9f4d5cf322fff480d4795d79533f840f9c975 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 10 Jan 2015 00:08:50 +0100 Subject: [PATCH] Upgrade db schema to v16 --- src/db.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index f0874fb8..22537b4f 100644 --- a/src/db.c +++ b/src/db.c @@ -4372,9 +4372,9 @@ db_perthread_deinit(void) " VALUES(8, 'Purchased', 0, 'media_kind = 1024', 0, '', 0, 8);" */ -#define SCHEMA_VERSION 15 +#define SCHEMA_VERSION 16 #define Q_SCVER \ - "INSERT INTO admin (key, value) VALUES ('schema_version', '15');" + "INSERT INTO admin (key, value) VALUES ('schema_version', '16');" struct db_init_query { char *query; @@ -5405,6 +5405,14 @@ db_upgrade_v15(void) #undef Q_DUMP } +#define U_V16_SCVER \ + "UPDATE admin SET value = '16' WHERE key = 'schema_version';" + +static const struct db_init_query db_upgrade_v16_queries[] = + { + { U_V16_SCVER, "set schema_version to 16" }, + }; + static int db_check_version(void) { @@ -5502,6 +5510,13 @@ db_check_version(void) if (ret < 0) return -1; + /* FALLTHROUGH */ + + case 15: + ret = db_generic_upgrade(db_upgrade_v16_queries, sizeof(db_upgrade_v16_queries) / sizeof(db_upgrade_v16_queries[0])); + if (ret < 0) + return -1; + break; default: