[db] Fixup commit #1edfadc

This commit is contained in:
ejurgensen 2020-02-23 00:54:28 +01:00
parent 3a48864001
commit 00de0a3f76
5 changed files with 8 additions and 9 deletions

View File

@ -426,7 +426,7 @@ static const char *sort_clause[] =
"f.virtual_path COLLATE NOCASE",
"pos",
"shuffle_pos",
"f.date_released DESC",
"f.date_released DESC, f.title_sort DESC",
};
/* Browse clauses, used for SELECT, WHERE, GROUP BY and for default ORDER BY

View File

@ -30,7 +30,7 @@ enum sort_type {
S_VPATH,
S_POS,
S_SHUFFLE_POS,
S_RELEASEDATE,
S_DATE_RELEASED,
};
#define Q_F_BROWSE (1 << 15)

View File

@ -335,6 +335,9 @@ static const struct db_init_query db_init_table_queries[] =
#define I_FILE_DIR \
"CREATE INDEX IF NOT EXISTS idx_file_dir ON files(disabled, directory_id);"
#define I_DATE_RELEASED \
"CREATE INDEX IF NOT EXISTS idx_date_released ON files(disabled, date_released DESC, media_kind);"
#define I_PL_PATH \
"CREATE INDEX IF NOT EXISTS idx_pl_path ON playlists(path);"
@ -368,9 +371,6 @@ static const struct db_init_query db_init_table_queries[] =
#define I_QUEUE_SHUFFLEPOS \
"CREATE INDEX IF NOT EXISTS idx_queue_shufflepos ON queue(shuffle_pos);"
#define I_FILE_DATE_RELEASED \
"CREATE INDEX IF NOT EXISTS idx_file_datereleased ON files(date_released);"
static const struct db_init_query db_init_index_queries[] =
{
{ I_RESCAN, "create rescan index" },
@ -387,6 +387,7 @@ static const struct db_init_query db_init_index_queries[] =
{ I_ALBUM, "create album index" },
{ I_FILELIST, "create filelist index" },
{ I_FILE_DIR, "create file dir index" },
{ I_DATE_RELEASED, "create date_released index" },
{ I_PL_PATH, "create playlist path index" },
{ I_PL_DISABLED, "create playlist state index" },
@ -404,8 +405,6 @@ static const struct db_init_query db_init_index_queries[] =
{ I_QUEUE_POS, "create queue pos index" },
{ I_QUEUE_SHUFFLEPOS, "create queue shuffle pos index" },
{ I_FILE_DATE_RELEASED, "create file date_released index" },
};

View File

@ -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 02
#define SCHEMA_VERSION_MINOR 03
int
db_init_indices(sqlite3 *hdl);

View File

@ -573,7 +573,7 @@ query_params_set(struct query_params *qp, int *sort_headers, struct httpd_reques
else if (strcmp(param, "artist") == 0 && (type != Q_BROWSE_ARTISTS)) // Only set if non-default sort requested
qp->sort = S_ARTIST;
else if (strcmp(param, "releasedate") == 0)
qp->sort = S_RELEASEDATE;
qp->sort = S_DATE_RELEASED;
else
DPRINTF(E_DBG, L_DAAP, "Unknown sort param: %s\n", param);