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

AlbumTrack: Cosmetics

parent efa088d6
...@@ -118,13 +118,17 @@ bool AlbumTrack::createTable( sqlite::Connection* dbConnection ) ...@@ -118,13 +118,17 @@ bool AlbumTrack::createTable( sqlite::Connection* dbConnection )
"FOREIGN KEY (album_id) REFERENCES Album(id_album) " "FOREIGN KEY (album_id) REFERENCES Album(id_album) "
" ON DELETE CASCADE" " ON DELETE CASCADE"
")"; ")";
const std::string triggerReq = "CREATE TRIGGER IF NOT EXISTS is_track_present AFTER UPDATE OF is_present " const std::string triggerReq = "CREATE TRIGGER IF NOT EXISTS is_track_present"
"ON " + policy::MediaTable::Name + "AFTER UPDATE OF is_present "
" BEGIN" "ON " + policy::MediaTable::Name + " "
" UPDATE " + policy::AlbumTrackTable::Name + " SET is_present = new.is_present WHERE media_id = new.id_media;" "BEGIN "
" END"; "UPDATE " + policy::AlbumTrackTable::Name + " "
const std::string indexReq = "CREATE INDEX IF NOT EXISTS album_media_artist_genre_album_idx ON " + "SET is_present = new.is_present WHERE media_id = new.id_media;"
policy::AlbumTrackTable::Name + "(media_id, artist_id, genre_id, album_id)"; "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 ) && return sqlite::Tools::executeRequest( dbConnection, req ) &&
sqlite::Tools::executeRequest( dbConnection, triggerReq ) && 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