mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
Handle database upgrade v6 -> v7
This commit is contained in:
parent
facb9957d8
commit
0e9a8674d9
25
src/db.c
25
src/db.c
@ -3435,6 +3435,24 @@ static struct db_init_query db_upgrade_v6_queries[] =
|
||||
{ U_V6_SCVER, "set schema_version to 6" },
|
||||
};
|
||||
|
||||
/* Upgrade from schema v6 to v7 */
|
||||
|
||||
#define U_V7_FILES \
|
||||
"ALTER TABLE files ADD COLUMN songalbumid INTEGER NOT NULL DEFAULT 0;"
|
||||
|
||||
#define U_V7_RESCAN \
|
||||
"UPDATE files SET db_timestamp = 1;"
|
||||
|
||||
#define U_V7_SCVER \
|
||||
"UPDATE admin SET value = '7' WHERE key = 'schema_version';"
|
||||
|
||||
static struct db_init_query db_upgrade_v7_queries[] =
|
||||
{
|
||||
{ U_V7_FILES, "upgrade table files" },
|
||||
{ U_V7_RESCAN, "force library rescan" },
|
||||
{ U_V7_SCVER, "set schema_version to 7" },
|
||||
};
|
||||
|
||||
static int
|
||||
db_check_version(void)
|
||||
{
|
||||
@ -3506,6 +3524,13 @@ db_check_version(void)
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 6:
|
||||
ret = db_generic_upgrade(db_upgrade_v7_queries, sizeof(db_upgrade_v7_queries) / sizeof(db_upgrade_v7_queries[0]));
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user