Isolate OnModelCreating in Data classes (#1702)

This commit is contained in:
Nicolas Dorier
2020-06-27 21:55:16 +09:00
committed by GitHub
parent 72e407b69d
commit be44c3f9c2
14 changed files with 178 additions and 130 deletions

View File

@@ -83,6 +83,10 @@ namespace BTCPayServer.Data
public RefundData CurrentRefund { get; set; }
internal static void OnModelCreating(ModelBuilder builder)
{
builder.Entity<InvoiceData>()
.HasOne(o => o.StoreData)
.WithMany(a => a.Invoices).OnDelete(DeleteBehavior.Cascade);
builder.Entity<InvoiceData>().HasIndex(o => o.StoreDataId);
builder.Entity<InvoiceData>()
.HasOne(o => o.CurrentRefund);
}