mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[db] add review 'flag' column to files/queue tbls
This commit is contained in:
parent
29cd5a7a19
commit
4dcc9b602e
4
src/db.c
4
src/db.c
@ -227,6 +227,7 @@ static const struct col_type_map mfi_cols_map[] =
|
||||
{ "album_artist_sort", mfi_offsetof(album_artist_sort), DB_TYPE_STRING, DB_FIXUP_ALBUM_ARTIST_SORT },
|
||||
{ "composer_sort", mfi_offsetof(composer_sort), DB_TYPE_STRING, DB_FIXUP_COMPOSER_SORT },
|
||||
{ "channels", mfi_offsetof(channels), DB_TYPE_INT },
|
||||
{ "flag", mfi_offsetof(flag), DB_TYPE_INT },
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
@ -294,6 +295,7 @@ static const struct col_type_map qi_cols_map[] =
|
||||
{ "bitrate", qi_offsetof(bitrate), DB_TYPE_INT },
|
||||
{ "samplerate", qi_offsetof(samplerate), DB_TYPE_INT },
|
||||
{ "channels", qi_offsetof(channels), DB_TYPE_INT },
|
||||
{ "flag", qi_offsetof(flag), DB_TYPE_INT },
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
@ -365,6 +367,7 @@ static const ssize_t dbmfi_cols_map[] =
|
||||
dbmfi_offsetof(album_artist_sort),
|
||||
dbmfi_offsetof(composer_sort),
|
||||
dbmfi_offsetof(channels),
|
||||
dbmfi_offsetof(flag),
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
@ -453,6 +456,7 @@ static const struct qi_mfi_map qi_mfi_map[] =
|
||||
{ qi_offsetof(bitrate), mfi_offsetof(bitrate), dbmfi_offsetof(bitrate) },
|
||||
{ qi_offsetof(samplerate), mfi_offsetof(samplerate), dbmfi_offsetof(samplerate) },
|
||||
{ qi_offsetof(channels), mfi_offsetof(channels), dbmfi_offsetof(channels) },
|
||||
{ qi_offsetof(flag), mfi_offsetof(flag), dbmfi_offsetof(flag) },
|
||||
};
|
||||
|
||||
/* This list must be kept in sync with
|
||||
|
4
src/db.h
4
src/db.h
@ -198,6 +198,7 @@ struct media_file_info {
|
||||
uint32_t time_skipped;
|
||||
|
||||
int64_t disabled; // Long because it stores up to INOTIFY_FAKE_COOKIE
|
||||
uint32_t flag;
|
||||
|
||||
uint64_t sample_count; //TODO [unused] sample count is never set and therefor always 0
|
||||
char *codectype; /* song.codectype, 4 chars max (32 bits) */
|
||||
@ -393,6 +394,7 @@ struct db_media_file_info {
|
||||
char *album_artist_sort;
|
||||
char *composer_sort;
|
||||
char *channels;
|
||||
char *flag;
|
||||
};
|
||||
|
||||
#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field)
|
||||
@ -502,6 +504,8 @@ struct db_queue_item {
|
||||
|
||||
int64_t songartistid;
|
||||
|
||||
uint32_t flag;
|
||||
|
||||
/* Not saved in queue table */
|
||||
uint32_t seek;
|
||||
};
|
||||
|
@ -96,7 +96,8 @@
|
||||
" album_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" album_artist_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" composer_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
|
||||
" channels INTEGER DEFAULT 0" \
|
||||
" channels INTEGER DEFAULT 0," \
|
||||
" flag INTEGER DEFAULT 0" \
|
||||
");"
|
||||
|
||||
#define T_PL \
|
||||
@ -199,7 +200,8 @@
|
||||
" type VARCHAR(8) DEFAULT NULL," \
|
||||
" bitrate INTEGER DEFAULT 0," \
|
||||
" samplerate INTEGER DEFAULT 0," \
|
||||
" channels INTEGER DEFAULT 0" \
|
||||
" channels INTEGER DEFAULT 0," \
|
||||
" flag INTEGER DEFAULT 0" \
|
||||
");"
|
||||
|
||||
#define Q_PL1 \
|
||||
|
@ -26,7 +26,7 @@
|
||||
* is a major upgrade. In other words minor version upgrades permit downgrading
|
||||
* the server after the database was upgraded. */
|
||||
#define SCHEMA_VERSION_MAJOR 21
|
||||
#define SCHEMA_VERSION_MINOR 06
|
||||
#define SCHEMA_VERSION_MINOR 07
|
||||
|
||||
int
|
||||
db_init_indices(sqlite3 *hdl);
|
||||
|
@ -1160,6 +1160,22 @@ static const struct db_upgrade_query db_upgrade_v2106_queries[] =
|
||||
{ U_v2106_SCVER_MINOR, "set schema_version_minor to 06" },
|
||||
};
|
||||
|
||||
/* ---------------------------- 21.06 -> 21.07 ------------------------------ */
|
||||
#define U_v2107_ALTER_FILES_PENDING_DELETE \
|
||||
"ALTER TABLE files ADD COLUMN flag INTEGER DEFAULT 0;"
|
||||
#define U_v2107_ALTER_QUEUE_PENDING_DELETE \
|
||||
"ALTER TABLE queue ADD COLUMN flag INTEGER DEFAULT 0;"
|
||||
#define U_v2107_SCVER_MINOR \
|
||||
"UPDATE admin SET value = '07' WHERE key = 'schema_version_minor';"
|
||||
|
||||
static const struct db_upgrade_query db_upgrade_v2107_queries[] =
|
||||
{
|
||||
{ U_v2107_ALTER_FILES_PENDING_DELETE, "update files adding flag" },
|
||||
{ U_v2107_ALTER_QUEUE_PENDING_DELETE, "update queue adding flag" },
|
||||
|
||||
{ U_v2107_SCVER_MINOR, "set schema_version_minor to 07" },
|
||||
};
|
||||
|
||||
|
||||
/* -------------------------- Main upgrade handler -------------------------- */
|
||||
|
||||
@ -1357,6 +1373,13 @@ db_upgrade(sqlite3 *hdl, int db_ver)
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 2106:
|
||||
ret = db_generic_upgrade(hdl, db_upgrade_v2107_queries, ARRAY_SIZE(db_upgrade_v2107_queries));
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
/* Last case statement is the only one that ends with a break statement! */
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user