fix: include Release nav on all TrackRepository query paths; add unique constraint on release(title, artist)

This commit is contained in:
daniel-c-harvey
2026-06-11 14:48:52 -04:00
parent f767d288c5
commit 70d4a87cd5
6 changed files with 246 additions and 7 deletions
@@ -56,5 +56,12 @@ public class ReleaseConfiguration : BaseEntityConfiguration<ReleaseEntity>
// calls HasIndex(e => e.IsDeleted); this adds HasDatabaseName so EF always uses
// "IX_release_is_deleted" regardless of auto-naming conventions.
builder.HasIndex(e => e.IsDeleted).HasDatabaseName("IX_release_is_deleted");
// Unique constraint on the natural key (title + artist). Prevents duplicate release rows
// from concurrent uploads of the same album. The FindOrCreateRelease path catches the
// resulting ClassifiedDbException (UniqueViolation) and re-queries for the winning row.
builder.HasIndex(e => new { e.Title, e.Artist })
.IsUnique()
.HasDatabaseName("IX_release_title_artist");
}
}