From 78194807db51e3c1af599a10a948029f7bc97691 Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Sun, 16 Feb 2020 15:15:52 +0000 Subject: [PATCH] [db] add S_RELEASEDATE and idx --- src/db.c | 1 + src/db.h | 1 + src/db_init.c | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/db.c b/src/db.c index bcb5927d..0f5d7fae 100644 --- a/src/db.c +++ b/src/db.c @@ -426,6 +426,7 @@ static const char *sort_clause[] = "f.virtual_path COLLATE NOCASE", "pos", "shuffle_pos", + "f.date_released DESC", }; /* Browse clauses, used for SELECT, WHERE, GROUP BY and for default ORDER BY diff --git a/src/db.h b/src/db.h index db0c9496..4f8e537c 100644 --- a/src/db.h +++ b/src/db.h @@ -30,6 +30,7 @@ enum sort_type { S_VPATH, S_POS, S_SHUFFLE_POS, + S_RELEASEDATE, }; #define Q_F_BROWSE (1 << 15) diff --git a/src/db_init.c b/src/db_init.c index e1b62bea..b1680900 100644 --- a/src/db_init.c +++ b/src/db_init.c @@ -368,6 +368,9 @@ 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" }, @@ -401,6 +404,8 @@ 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" }, };