Upgrade database schema to v15.0 -> 15.1
This commit is contained in:
parent
d16cf2fe7c
commit
da376cbeb9
29
src/db.c
29
src/db.c
|
@ -4373,10 +4373,14 @@ db_perthread_deinit(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SCHEMA_VERSION_MAJOR 15
|
#define SCHEMA_VERSION_MAJOR 15
|
||||||
#define SCHEMA_VERSION_MINOR 00
|
#define SCHEMA_VERSION_MINOR 01
|
||||||
// Q_SCVER should be deprecated/removed at v16
|
// Q_SCVER should be deprecated/removed at v16
|
||||||
#define Q_SCVER \
|
#define Q_SCVER \
|
||||||
"INSERT INTO admin (key, value) VALUES ('schema_version', '15');"
|
"INSERT INTO admin (key, value) VALUES ('schema_version', '15');"
|
||||||
|
#define Q_SCVER_MAJOR \
|
||||||
|
"INSERT INTO admin (key, value) VALUES ('schema_version_major', '15');"
|
||||||
|
#define Q_SCVER_MINOR \
|
||||||
|
"INSERT INTO admin (key, value) VALUES ('schema_version_minor', '01');"
|
||||||
|
|
||||||
struct db_init_query {
|
struct db_init_query {
|
||||||
char *query;
|
char *query;
|
||||||
|
@ -4405,6 +4409,8 @@ static const struct db_init_query db_init_table_queries[] =
|
||||||
{ Q_PL6, "create default smart playlist 'Audiobooks'" },
|
{ Q_PL6, "create default smart playlist 'Audiobooks'" },
|
||||||
|
|
||||||
{ Q_SCVER, "set schema version" },
|
{ Q_SCVER, "set schema version" },
|
||||||
|
{ Q_SCVER_MAJOR, "set schema version major" },
|
||||||
|
{ Q_SCVER_MINOR, "set schema version minor" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -5408,6 +5414,20 @@ db_upgrade_v15(void)
|
||||||
#undef Q_DUMP
|
#undef Q_DUMP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Upgrade from schema v15 to v15.01 */
|
||||||
|
/* Improved indices (will be generated by generic schema update) */
|
||||||
|
|
||||||
|
#define U_V1501_SCVER_MAJOR \
|
||||||
|
"INSERT INTO admin (key, value) VALUES ('schema_version_major', '15');"
|
||||||
|
#define U_V1501_SCVER_MINOR \
|
||||||
|
"INSERT INTO admin (key, value) VALUES ('schema_version_minor', '01');"
|
||||||
|
|
||||||
|
static const struct db_init_query db_upgrade_v1501_queries[] =
|
||||||
|
{
|
||||||
|
{ U_V1501_SCVER_MAJOR, "set schema_version_major to 15" },
|
||||||
|
{ U_V1501_SCVER_MINOR, "set schema_version_minor to 01" },
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
db_check_version(void)
|
db_check_version(void)
|
||||||
{
|
{
|
||||||
|
@ -5515,6 +5535,13 @@ db_check_version(void)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
|
case 1500:
|
||||||
|
ret = db_generic_upgrade(db_upgrade_v1501_queries, sizeof(db_upgrade_v1501_queries) / sizeof(db_upgrade_v1501_queries[0]));
|
||||||
|
if (ret < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue