quintodrome/db/migration/20211102215414_add_alphabetical_by_artist_index.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
518 B
Go
Raw Normal View History

package migrations
import (
2023-11-27 10:46:44 -09:00
"context"
"database/sql"
2023-04-04 05:57:00 -08:00
"github.com/pressly/goose/v3"
)
func init() {
2023-11-27 10:46:44 -09:00
goose.AddMigrationContext(upAddAlphabeticalByArtistIndex, downAddAlphabeticalByArtistIndex)
}
2023-11-27 10:46:44 -09:00
func upAddAlphabeticalByArtistIndex(_ context.Context, 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
}
2023-11-27 10:46:44 -09:00
func downAddAlphabeticalByArtistIndex(_ context.Context, tx *sql.Tx) error {
return nil
}