mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-06 10:23:21 +03:00
Add more indexes to MediaFile table
This commit is contained in:
parent
0ba5840a65
commit
86a23f9b14
30
db/migration/20200404214704_add_indexes.go
Normal file
30
db/migration/20200404214704_add_indexes.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package migration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
|
||||||
|
"github.com/pressly/goose"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
goose.AddMigration(Up20200404214704, Down20200404214704)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Up20200404214704(tx *sql.Tx) error {
|
||||||
|
_, err := tx.Exec(`
|
||||||
|
create index if not exists media_file_year
|
||||||
|
on media_file (year);
|
||||||
|
|
||||||
|
create index if not exists media_file_duration
|
||||||
|
on media_file (duration);
|
||||||
|
|
||||||
|
create index if not exists media_file_track_number
|
||||||
|
on media_file (disc_number, track_number);
|
||||||
|
`)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func Down20200404214704(tx *sql.Tx) error {
|
||||||
|
// This code is executed when the migration is rolled back.
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user