Files
navidrome/db/migration/20201010162350_add_album_size.go
T
Jay R. Wren fd6edf967f Add size to album details (#561)
* add size to album details

for #534

* addressing review comments:

* create index album(size)
* remove unneeded Size field from refresh struct
* add whitespace to album details
* add size to album list view

* prettier
2020-10-12 11:10:07 -04:00

31 lines
585 B
Go

package migration
import (
"database/sql"
"github.com/pressly/goose"
)
func init() {
goose.AddMigration(Up20201010162350, Down20201010162350)
}
func Up20201010162350(tx *sql.Tx) error {
_, err := tx.Exec(`
alter table album
add size integer default 0 not null;
create index if not exists album_size
on album(size);
`)
if err != nil {
return err
}
notice(tx, "A full rescan will be performed to calculate album sizes.")
return forceFullRescan(tx)
}
func Down20201010162350(tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
return nil
}