Commit 8eaae86a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

AlbumTrack: Cosmetics

(cherry picked from commit c6d82427

)
Signed-off-by: Hugo Beauzée-Luyssen's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent dbdb06e7
......@@ -118,13 +118,17 @@ bool AlbumTrack::createTable( sqlite::Connection* dbConnection )
"FOREIGN KEY (album_id) REFERENCES Album(id_album) "
" ON DELETE CASCADE"
")";
const std::string triggerReq = "CREATE TRIGGER IF NOT EXISTS is_track_present AFTER UPDATE OF is_present "
"ON " + policy::MediaTable::Name +
" BEGIN"
" UPDATE " + policy::AlbumTrackTable::Name + " SET is_present = new.is_present WHERE media_id = new.id_media;"
" END";
const std::string indexReq = "CREATE INDEX IF NOT EXISTS album_media_artist_genre_album_idx ON " +
policy::AlbumTrackTable::Name + "(media_id, artist_id, genre_id, album_id)";
const std::string triggerReq = "CREATE TRIGGER IF NOT EXISTS is_track_present"
"AFTER UPDATE OF is_present "
"ON " + policy::MediaTable::Name + " "
"BEGIN "
"UPDATE " + policy::AlbumTrackTable::Name + " "
"SET is_present = new.is_present WHERE media_id = new.id_media;"
"END";
const std::string indexReq = "CREATE INDEX IF NOT EXISTS "
"album_media_artist_genre_album_idx ON " +
policy::AlbumTrackTable::Name +
"(media_id, artist_id, genre_id, album_id)";
return sqlite::Tools::executeRequest( dbConnection, req ) &&
sqlite::Tools::executeRequest( dbConnection, triggerReq ) &&
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment