Add a new index for album, to optimize the `getAlbumList?type=alphabeticalByArtist` Subsonic query

This commit is contained in:
Deluan 2021-11-02 22:08:05 -04:00
parent 9712a5b1c6
commit 9e48d87f84
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package migrations
import (
"database/sql"
"github.com/pressly/goose"
)
func init() {
goose.AddMigration(upAddAlphabeticalByArtistIndex, downAddAlphabeticalByArtistIndex)
}
func upAddAlphabeticalByArtistIndex(tx *sql.Tx) error {
_, err := tx.Exec(`
create index album_alphabetical_by_artist
ON album(compilation, order_album_artist_name, order_album_name)
`)
return err
}
func downAddAlphabeticalByArtistIndex(tx *sql.Tx) error {
return nil
}