[smartpl] include smart playlists in filelist view and recreate the view

during db upgrade to v17
This commit is contained in:
chme 2015-04-18 07:25:06 +02:00
parent 4cac01ed88
commit baa97b886d
1 changed files with 23 additions and 9 deletions

View File

@ -4591,7 +4591,7 @@ db_perthread_deinit(void)
" UNION " \ " UNION " \
" SELECT " \ " SELECT " \
" virtual_path, db_timestamp, 1 as type " \ " virtual_path, db_timestamp, 1 as type " \
" FROM playlists where disabled = 0 AND type = 0" \ " FROM playlists where disabled = 0 AND type IN (0, 3)" \
";" ";"
#define TRG_GROUPS_INSERT_FILES \ #define TRG_GROUPS_INSERT_FILES \
@ -5846,6 +5846,18 @@ db_upgrade_v16(void)
"ALTER TABLE playlists ADD COLUMN parent_id INTEGER DEFAULT 0;" "ALTER TABLE playlists ADD COLUMN parent_id INTEGER DEFAULT 0;"
#define U_V17_PL_TYPE_CHANGE \ #define U_V17_PL_TYPE_CHANGE \
"UPDATE playlists SET type = 2 WHERE type = 1;" "UPDATE playlists SET type = 2 WHERE type = 1;"
#define U_V17_DROP_VIEW_FILELIST \
"DROP VIEW IF EXISTS filelist;"
#define U_V17_CREATE_VIEW_FILELIST \
"CREATE VIEW IF NOT EXISTS filelist as" \
" SELECT " \
" virtual_path, time_modified, 3 as type " \
" FROM files WHERE disabled = 0" \
" UNION " \
" SELECT " \
" virtual_path, db_timestamp, 1 as type " \
" FROM playlists where disabled = 0 AND type IN (0, 3)" \
";"
#define U_V17_SCVER_MAJOR \ #define U_V17_SCVER_MAJOR \
"UPDATE admin SET value = '17' WHERE key = 'schema_version_major';" "UPDATE admin SET value = '17' WHERE key = 'schema_version_major';"
@ -5856,6 +5868,8 @@ static const struct db_init_query db_upgrade_v17_queries[] =
{ {
{ U_V17_PL_PARENTID_ADD,"expanding table playlists with parent_id column" }, { U_V17_PL_PARENTID_ADD,"expanding table playlists with parent_id column" },
{ U_V17_PL_TYPE_CHANGE, "changing numbering of default playlists 1 -> 2" }, { U_V17_PL_TYPE_CHANGE, "changing numbering of default playlists 1 -> 2" },
{ U_V17_DROP_VIEW_FILELIST, "dropping view filelist" },
{ U_V17_CREATE_VIEW_FILELIST, "creating view filelist" },
{ U_V17_SCVER_MAJOR, "set schema_version_major to 17" }, { U_V17_SCVER_MAJOR, "set schema_version_major to 17" },
{ U_V17_SCVER_MINOR, "set schema_version_minor to 00" }, { U_V17_SCVER_MINOR, "set schema_version_minor to 00" },