fix: force full rescan to enable search by album artist
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package migration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
|
||||||
|
"github.com/pressly/goose"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
goose.AddMigration(Up20200310171621, Down20200310171621)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Up20200310171621(tx *sql.Tx) error {
|
||||||
|
notice(tx, "A full rescan will be performed to enable search by Album Artist!")
|
||||||
|
return forceFullRescan(tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Down20200310171621(tx *sql.Tx) error {
|
||||||
|
// This code is executed when the migration is rolled back.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -20,6 +20,15 @@ NOTICE: %s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call this in migrations that requires a full rescan
|
||||||
|
func forceFullRescan(tx *sql.Tx) error {
|
||||||
|
_, err := tx.Exec(`
|
||||||
|
delete from property where id like 'LastScan%';
|
||||||
|
update media_file set updated_at = '0001-01-01';
|
||||||
|
`)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
|
||||||
func isDBInitialized(tx *sql.Tx) (initialized bool) {
|
func isDBInitialized(tx *sql.Tx) (initialized bool) {
|
||||||
|
|||||||
Reference in New Issue
Block a user