Add a new index for album, to optimize the `getAlbumList?type=alphabeticalByArtist` Subsonic query
This commit is contained in:
parent
9712a5b1c6
commit
9e48d87f84
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue