navidrome/db/migrations/20210322132848_add_timestam...

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

35 lines
818 B
Go
Raw Normal View History

2021-03-22 18:38:20 +01:00
package migrations
import (
2023-11-27 20:46:44 +01:00
"context"
2021-03-22 18:38:20 +01:00
"database/sql"
2023-04-04 15:57:00 +02:00
"github.com/pressly/goose/v3"
2021-03-22 18:38:20 +01:00
)
func init() {
2023-11-27 20:46:44 +01:00
goose.AddMigrationContext(upAddTimestampIndexesGo, downAddTimestampIndexesGo)
2021-03-22 18:38:20 +01:00
}
2023-11-27 20:46:44 +01:00
func upAddTimestampIndexesGo(_ context.Context, tx *sql.Tx) error {
2021-03-22 18:38:20 +01:00
_, err := tx.Exec(`
create index if not exists album_updated_at
on album (updated_at);
create index if not exists album_created_at
on album (created_at);
create index if not exists playlist_updated_at
on playlist (updated_at);
create index if not exists playlist_created_at
on playlist (created_at);
create index if not exists media_file_created_at
on media_file (created_at);
create index if not exists media_file_updated_at
on media_file (updated_at);
`)
return err
}
2023-11-27 20:46:44 +01:00
func downAddTimestampIndexesGo(_ context.Context, tx *sql.Tx) error {
2021-03-22 18:38:20 +01:00
return nil
}