Handle database upgrade v6 -> v7

This commit is contained in:
Julien BLACHE 2010-03-06 17:29:10 +01:00
parent facb9957d8
commit 0e9a8674d9

View File

@ -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: