mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[db] Upgrade schema to 21.05 (change auth_keys in speaker table)
This commit is contained in:
parent
3ea480d1e7
commit
9cdd2a9f8b
@ -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 21
|
||||
#define SCHEMA_VERSION_MINOR 04
|
||||
#define SCHEMA_VERSION_MINOR 05
|
||||
|
||||
int
|
||||
db_init_indices(sqlite3 *hdl);
|
||||
|
@ -1060,6 +1060,19 @@ static const struct db_upgrade_query db_upgrade_v2104_queries[] =
|
||||
{ U_v2104_SCVER_MINOR, "set schema_version_minor to 04" },
|
||||
};
|
||||
|
||||
// Previously, the auth_key contained the public key twice
|
||||
#define U_v2105_UPDATE_SPEAKERS_AUTH_KEY \
|
||||
"UPDATE speakers SET auth_key = SUBSTR(auth_key, LENGTH(auth_key) - 128 + 1, LENGTH(auth_key) + 1) WHERE LENGTH(auth_key) = 128 + 64;"
|
||||
#define U_v2105_SCVER_MINOR \
|
||||
"UPDATE admin SET value = '05' WHERE key = 'schema_version_minor';"
|
||||
|
||||
static const struct db_upgrade_query db_upgrade_v2105_queries[] =
|
||||
{
|
||||
{ U_v2105_UPDATE_SPEAKERS_AUTH_KEY, "update table speakers auth_key length" },
|
||||
|
||||
{ U_v2105_SCVER_MINOR, "set schema_version_minor to 05" },
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
db_upgrade(sqlite3 *hdl, int db_ver)
|
||||
@ -1237,6 +1250,14 @@ db_upgrade(sqlite3 *hdl, int db_ver)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 2104:
|
||||
ret = db_generic_upgrade(hdl, db_upgrade_v2105_queries, ARRAY_SIZE(db_upgrade_v2105_queries));
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINTF(E_FATAL, L_DB, "No upgrade path from the current DB schema\n");
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user