mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
[db] Rename "plversion" to "queue_version", add missing init query for
queue_version
This commit is contained in:
parent
6c7df96371
commit
b5bf1928ff
28
src/db.c
28
src/db.c
@ -4204,14 +4204,14 @@ int
|
|||||||
db_queue_get_version()
|
db_queue_get_version()
|
||||||
{
|
{
|
||||||
char *version;
|
char *version;
|
||||||
int32_t plversion;
|
int32_t queue_version;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
plversion = 0;
|
queue_version = 0;
|
||||||
version = db_admin_get("plversion");
|
version = db_admin_get("queue_version");
|
||||||
if (version)
|
if (version)
|
||||||
{
|
{
|
||||||
ret = safe_atoi32(version, &plversion);
|
ret = safe_atoi32(version, &queue_version);
|
||||||
free(version);
|
free(version);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -4220,7 +4220,7 @@ db_queue_get_version()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return plversion;
|
return queue_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4233,29 +4233,29 @@ db_queue_get_version()
|
|||||||
static void
|
static void
|
||||||
queue_inc_version_and_notify()
|
queue_inc_version_and_notify()
|
||||||
{
|
{
|
||||||
int plversion;
|
int queue_version;
|
||||||
char version[10];
|
char version[10];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
db_transaction_begin();
|
db_transaction_begin();
|
||||||
|
|
||||||
plversion = db_queue_get_version();
|
queue_version = db_queue_get_version();
|
||||||
if (plversion < 0)
|
if (queue_version < 0)
|
||||||
plversion = 0;
|
queue_version = 0;
|
||||||
|
|
||||||
plversion++;
|
queue_version++;
|
||||||
ret = snprintf(version, sizeof(version), "%d", plversion);
|
ret = snprintf(version, sizeof(version), "%d", queue_version);
|
||||||
if (ret >= sizeof(version))
|
if (ret >= sizeof(version))
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not convert version to string: %d\n", plversion);
|
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not convert version to string: %d\n", queue_version);
|
||||||
db_transaction_rollback();
|
db_transaction_rollback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = db_admin_update("plversion", version);
|
ret = db_admin_update("queue_version", version);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not update version in admin table: %d\n", plversion);
|
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not update version in admin table: %d\n", queue_version);
|
||||||
db_transaction_rollback();
|
db_transaction_rollback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,9 @@
|
|||||||
"INSERT INTO directories (id, virtual_path, db_timestamp, disabled, parent_id)" \
|
"INSERT INTO directories (id, virtual_path, db_timestamp, disabled, parent_id)" \
|
||||||
" VALUES (4, '/spotify:', 0, 4294967296, 1);"
|
" VALUES (4, '/spotify:', 0, 4294967296, 1);"
|
||||||
|
|
||||||
|
#define Q_QUEUE_VERSION \
|
||||||
|
"INSERT INTO admin (key, value) VALUES ('queue_version', '0');"
|
||||||
|
|
||||||
#define Q_SCVER_MAJOR \
|
#define Q_SCVER_MAJOR \
|
||||||
"INSERT INTO admin (key, value) VALUES ('schema_version_major', '%d');"
|
"INSERT INTO admin (key, value) VALUES ('schema_version_major', '%d');"
|
||||||
#define Q_SCVER_MINOR \
|
#define Q_SCVER_MINOR \
|
||||||
@ -278,6 +281,7 @@ static const struct db_init_query db_init_table_queries[] =
|
|||||||
{ Q_DIR2, "create default base directory '/file:'" },
|
{ Q_DIR2, "create default base directory '/file:'" },
|
||||||
{ Q_DIR3, "create default base directory '/http:'" },
|
{ Q_DIR3, "create default base directory '/http:'" },
|
||||||
{ Q_DIR4, "create default base directory '/spotify:'" },
|
{ Q_DIR4, "create default base directory '/spotify:'" },
|
||||||
|
{ Q_QUEUE_VERSION, "initialize queue version" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1471,8 +1471,8 @@ db_upgrade_v19(sqlite3 *hdl)
|
|||||||
" disc INTEGER DEFAULT 0" \
|
" disc INTEGER DEFAULT 0" \
|
||||||
");"
|
");"
|
||||||
|
|
||||||
#define U_V2000_PLVERSION \
|
#define U_V2000_QUEUE_VERSION \
|
||||||
"INSERT INTO admin (key, value) VALUES ('plversion', '0');"
|
"INSERT INTO admin (key, value) VALUES ('queue_version', '0');"
|
||||||
|
|
||||||
#define U_V2000_SCVER_MAJOR \
|
#define U_V2000_SCVER_MAJOR \
|
||||||
"UPDATE admin SET value = '20' WHERE key = 'schema_version_major';"
|
"UPDATE admin SET value = '20' WHERE key = 'schema_version_major';"
|
||||||
@ -1482,7 +1482,7 @@ db_upgrade_v19(sqlite3 *hdl)
|
|||||||
static const struct db_upgrade_query db_upgrade_v2000_queries[] =
|
static const struct db_upgrade_query db_upgrade_v2000_queries[] =
|
||||||
{
|
{
|
||||||
{ U_V2000_CREATE_TABLE_QUEUE, "create table directories" },
|
{ U_V2000_CREATE_TABLE_QUEUE, "create table directories" },
|
||||||
{ U_V2000_PLVERSION, "insert plversion" },
|
{ U_V2000_QUEUE_VERSION, "insert plversion" },
|
||||||
|
|
||||||
{ U_V2000_SCVER_MAJOR, "set schema_version_major to 20" },
|
{ U_V2000_SCVER_MAJOR, "set schema_version_major to 20" },
|
||||||
{ U_V2000_SCVER_MINOR, "set schema_version_minor to 00" },
|
{ U_V2000_SCVER_MINOR, "set schema_version_minor to 00" },
|
||||||
|
Loading…
Reference in New Issue
Block a user