I am using EF Core 9.0.2 (database-first) with the (unmodified) SQLite example chinook.db, for testing.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Album>(entity =>
{
entity.HasIndex(e => e.ArtistId, "IFK_AlbumArtistId");
entity.Property(e => e.Quantity).HasDefaultValue(0);
entity.Property(e => e.Title)
.IsRequired()
.HasColumnType("NVARCHAR(160)");
entity.HasOne(d => d.Artist).WithMany(p => p.Albums)
.HasForeignKey(d => d.ArtistId)
.OnDelete(DeleteBehavior.ClientSetNull);
});
When I delete an Album item, I get this exception:
SQLite Error 19: 'FOREIGN KEY constraint failed
I checked the database (original) and it's correct.
I have found several reports of this exception, but I can't resolve it.
This is the schema:

albumhave a relationship withtracksthat are expected to be deleted before deleting the parent album? can you enable cascade delete to overcome the need of explicitely delete the tree?albumandtracks.. you can't delete analbumif there are existing recordstracksbelonging to it. You tried the cascade delete but if it didn't work I don't know howtrackstable with a relationship withalbumsand there's no data model you can define to change that.