quintodrome/db/migration/20221219140528_remove_cover_art_id.go

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

29 lines
594 B
Go
Raw Normal View History

2022-12-19 10:11:43 -09:00
package migrations
import (
2023-11-27 10:46:44 -09:00
"context"
2022-12-19 10:11:43 -09:00
"database/sql"
2023-04-04 05:57:00 -08:00
"github.com/pressly/goose/v3"
2022-12-19 10:11:43 -09:00
)
func init() {
2023-11-27 10:46:44 -09:00
goose.AddMigrationContext(upRemoveCoverArtId, downRemoveCoverArtId)
2022-12-19 10:11:43 -09:00
}
2023-11-27 10:46:44 -09:00
func upRemoveCoverArtId(_ context.Context, tx *sql.Tx) error {
2022-12-19 10:11:43 -09:00
_, err := tx.Exec(`
alter table album drop column cover_art_id;
alter table album rename column cover_art_path to embed_art_path
`)
if err != nil {
return err
}
notice(tx, "A full rescan needs to be performed to import all album images")
return forceFullRescan(tx)
}
2023-11-27 10:46:44 -09:00
func downRemoveCoverArtId(_ context.Context, tx *sql.Tx) error {
2022-12-19 10:11:43 -09:00
return nil
}