[db] Upgrade db to 19.03: Add artwork_url column to queue table

This commit is contained in:
ejurgensen 2017-01-22 23:08:26 +01:00
parent 40d50d693b
commit e92152cadb
3 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,4 @@
/*
* Copyright (C) 2009-2011 Julien BLACHE <jb@jblache.org>
* Copyright (C) 2010 Kai Elwert <elwertk@googlemail.com>
@ -182,6 +183,7 @@
" year INTEGER DEFAULT 0," \
" track INTEGER DEFAULT 0," \
" disc INTEGER DEFAULT 0" \
" artwork_url VARCHAR(4096) DEFAULT NULL," \
");"
#define TRG_GROUPS_INSERT_FILES \

View File

@ -26,7 +26,7 @@
* is a major upgrade. In other words minor version upgrades permit downgrading
* forked-daapd after the database was upgraded. */
#define SCHEMA_VERSION_MAJOR 19
#define SCHEMA_VERSION_MINOR 02
#define SCHEMA_VERSION_MINOR 03
int
db_init_indices(sqlite3 *hdl);

View File

@ -1529,6 +1529,24 @@ static const struct db_upgrade_query db_upgrade_v1902_queries[] =
{ U_V1902_SCVER_MINOR, "set schema_version_minor to 02" },
};
#define U_V1903_ALTER_QUEUE_ADD_ARTWORKURL \
"ALTER TABLE queue ADD COLUMN artwork_url VARCHAR(4096) DEFAULT NULL;"
#define U_V1903_SCVER_MAJOR \
"UPDATE admin SET value = '19' WHERE key = 'schema_version_major';"
#define U_V1903_SCVER_MINOR \
"UPDATE admin SET value = '03' WHERE key = 'schema_version_minor';"
static const struct db_upgrade_query db_upgrade_v1903_queries[] =
{
{ U_V1903_ALTER_QUEUE_ADD_ARTWORKURL, "alter table queue add column artwork_url" },
{ U_V1903_SCVER_MAJOR, "set schema_version_major to 19" },
{ U_V1903_SCVER_MINOR, "set schema_version_minor to 03" },
};
int
db_upgrade(sqlite3 *hdl, int db_ver)
{
@ -1651,6 +1669,11 @@ db_upgrade(sqlite3 *hdl, int db_ver)
if (ret < 0)
return -1;
case 1902:
ret = db_generic_upgrade(hdl, db_upgrade_v1903_queries, sizeof(db_upgrade_v1903_queries) / sizeof(db_upgrade_v1903_queries[0]));
if (ret < 0)
return -1;
break;
default: