Fix null values in DB (#2840)

* Fix album image_files being null.

* Fix small nitpick.

* Use ExecContext instead of Exec.

* Change more columns to not null and set default values.

* Remove columns that don't need to be changed from migration.

* Fix typo.

* Remove unnecessary select statements.

* Remove duplicate code.

* Do not apply changes to radio table.

* Do not apply changes full_text columns and respective indexes.

* Fix musicbrainz columns.

* Rename migration.

* Make ExternalInfoUpdatedAt nullable

* Make Share's timestamps nullable

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
This commit is contained in:
Caio Cotts 2024-02-07 17:45:08 -08:00 committed by GitHub
parent ac4ceab143
commit bf2bcb1279
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 693 additions and 84 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/navidrome/navidrome/core/artwork"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
. "github.com/navidrome/navidrome/utils/gg"
"github.com/navidrome/navidrome/utils/slice"
"golang.org/x/exp/maps"
)
@ -139,7 +140,7 @@ func (r *refresher) refreshArtists(ctx context.Context, ids ...string) error {
a := model.Albums(group).ToAlbumArtist()
// Force a external metadata lookup on next access
a.ExternalInfoUpdatedAt = time.Time{}
a.ExternalInfoUpdatedAt = P(time.Time{})
// Do not remove old metadata
err := repo.Put(&a, "album_count", "genres", "external_info_updated_at", "mbz_artist_id", "name", "order_artist_name", "size", "sort_artist_name", "song_count")