set a temporary album tag artist for those who mightn't have it yet

This commit is contained in:
sentriz
2023-11-08 23:05:16 +00:00
parent 0718aabbac
commit 50c90e8ee3
2 changed files with 16 additions and 21 deletions

View File

@@ -70,6 +70,7 @@ func (db *DB) Migrate(ctx MigrationContext) error {
construct(ctx, "202310281803", migrateTrackArtists),
construct(ctx, "202311062259", migrateArtistAppearances),
construct(ctx, "202311072309", migrateAlbumInfo),
construct(ctx, "202311082304", migrateTemporaryDisplayAlbumArtist),
}
return gormigrate.
@@ -787,3 +788,17 @@ func migrateAlbumInfo(tx *gorm.DB, _ MigrationContext) error {
).
Error
}
func migrateTemporaryDisplayAlbumArtist(tx *gorm.DB, _ MigrationContext) error {
// keep some things working so that people have an album.tag_artist_id until their next full scan
return tx.Exec(`
UPDATE albums
SET tag_album_artist=(
SELECT group_concat(artists.name, ', ')
FROM artists
JOIN album_artists ON album_artists.artist_id=artists.id AND album_artists.album_id=albums.id
GROUP BY album_artists.album_id
)
WHERE tag_album_artist=''
`).Error
}