package migrationsimport ("context""database/sql""github.com/pressly/goose/v3")func init() {goose.AddMigrationContext(Up20200327193744, Down20200327193744)}func Up20200327193744(ctx context.Context, tx *sql.Tx) error {_, err := tx.ExecContext(ctx, `create table album_dg_tmp(id varchar(255) not nullprimary key,name varchar(255) default '' not null,artist_id varchar(255) default '' not null,cover_art_path varchar(255) default '' not null,cover_art_id varchar(255) default '' not null,artist varchar(255) default '' not null,album_artist varchar(255) default '' not null,min_year int default 0 not null,max_year integer default 0 not null,compilation bool default FALSE not null,song_count integer default 0 not null,duration real default 0 not null,genre varchar(255) default '' not null,created_at datetime,updated_at datetime,full_text varchar(255) default '',album_artist_id varchar(255) default '');insert into album_dg_tmp(id, name, artist_id, cover_art_path, cover_art_id, artist, album_artist, max_year, compilation, song_count, duration, genre, created_at, updated_at, full_text, album_artist_id) select id, name, artist_id, cover_art_path, cover_art_id, artist, album_artist, year, compilation, song_count, duration, genre, created_at, updated_at, full_text, album_artist_id from album;drop table album;alter table album_dg_tmp rename to album;create index album_artiston album (artist);create index album_artist_albumon album (artist);create index album_artist_album_idon album (album_artist_id);create index album_artist_idon album (artist_id);create index album_full_texton album (full_text);create index album_genreon album (genre);create index album_nameon album (name);create index album_min_yearon album (min_year);create index album_max_yearon album (max_year);`)if err != nil {return err}notice(ctx, tx, "A full rescan will be performed!")return forceFullRescan(ctx, tx)}func Down20200327193744(_ context.Context, _ *sql.Tx) error {return nil}