navidrome/db/migrations/20201021085410_add_mbids.go

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

60 lines
1.3 KiB
Go
Raw Normal View History

package migrations
import (
2023-11-27 20:46:44 +01:00
"context"
"database/sql"
2023-04-04 15:57:00 +02:00
"github.com/pressly/goose/v3"
)
func init() {
2023-11-27 20:46:44 +01:00
goose.AddMigrationContext(Up20201021085410, Down20201021085410)
}
2023-11-27 20:46:44 +01:00
func Up20201021085410(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add mbz_track_id varchar(255);
alter table media_file
add mbz_album_id varchar(255);
alter table media_file
add mbz_artist_id varchar(255);
alter table media_file
add mbz_album_artist_id varchar(255);
alter table media_file
add mbz_album_type varchar(255);
alter table media_file
add mbz_album_comment varchar(255);
alter table media_file
add catalog_num varchar(255);
alter table album
add mbz_album_id varchar(255);
alter table album
add mbz_album_artist_id varchar(255);
alter table album
add mbz_album_type varchar(255);
alter table album
add mbz_album_comment varchar(255);
alter table album
add catalog_num varchar(255);
create index if not exists album_mbz_album_type
on album (mbz_album_type);
alter table artist
add mbz_artist_id varchar(255);
`)
if err != nil {
return err
}
notice(tx, "A full rescan needs to be performed to import more tags")
return forceFullRescan(tx)
}
2023-11-27 20:46:44 +01:00
func Down20201021085410(_ context.Context, tx *sql.Tx) error {
2020-10-21 15:02:51 +02:00
// This code is executed when the migration is rolled back.
return nil
}