mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 19:37:37 +01:00
Improve invoice list performance (#3742)
This commit is contained in:
parent
76a6d94bbe
commit
174e743904
3 changed files with 112 additions and 38 deletions
|
@ -43,6 +43,7 @@ namespace BTCPayServer.Data
|
||||||
builder.Entity<InvoiceData>().HasIndex(o => o.OrderId);
|
builder.Entity<InvoiceData>().HasIndex(o => o.OrderId);
|
||||||
builder.Entity<InvoiceData>()
|
builder.Entity<InvoiceData>()
|
||||||
.HasOne(o => o.CurrentRefund);
|
.HasOne(o => o.CurrentRefund);
|
||||||
|
builder.Entity<InvoiceData>().HasIndex(o => o.Created);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using BTCPayServer.Data;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BTCPayServer.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20220518061525_invoice_created_idx")]
|
||||||
|
public partial class invoice_created_idx : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Invoices_Created",
|
||||||
|
table: "Invoices",
|
||||||
|
column: "Created");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Invoices_Created",
|
||||||
|
table: "Invoices");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -174,6 +174,61 @@ namespace BTCPayServer.Migrations
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
b.ToTable("AspNetUsers", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BTCPayServer.Data.CustodianAccountData", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Blob")
|
||||||
|
.HasColumnType("BLOB");
|
||||||
|
|
||||||
|
b.Property<string>("CustodianCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("StoreId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreId");
|
||||||
|
|
||||||
|
b.ToTable("CustodianAccount");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BTCPayServer.Data.Data.PayoutProcessorData", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<byte[]>("Blob")
|
||||||
|
.HasColumnType("BLOB");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Processor")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("StoreId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreId");
|
||||||
|
|
||||||
|
b.ToTable("PayoutProcessors");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BTCPayServer.Data.Fido2Credential", b =>
|
modelBuilder.Entity("BTCPayServer.Data.Fido2Credential", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
|
@ -258,6 +313,8 @@ namespace BTCPayServer.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Created");
|
||||||
|
|
||||||
b.HasIndex("OrderId");
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
b.HasIndex("StoreDataId");
|
b.HasIndex("StoreDataId");
|
||||||
|
@ -853,31 +910,6 @@ namespace BTCPayServer.Migrations
|
||||||
b.ToTable("WebhookDeliveries");
|
b.ToTable("WebhookDeliveries");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BTCPayServer.PayoutProcessors.PayoutProcessorData", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<byte[]>("Blob")
|
|
||||||
.HasColumnType("BLOB");
|
|
||||||
|
|
||||||
b.Property<string>("PaymentMethod")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Processor")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("StoreId")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("StoreId");
|
|
||||||
|
|
||||||
b.ToTable("PayoutProcessors");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
|
@ -1043,6 +1075,27 @@ namespace BTCPayServer.Migrations
|
||||||
b.Navigation("StoreData");
|
b.Navigation("StoreData");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BTCPayServer.Data.CustodianAccountData", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
|
||||||
|
.WithMany("CustodianAccounts")
|
||||||
|
.HasForeignKey("StoreId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("StoreData");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BTCPayServer.Data.Data.PayoutProcessorData", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BTCPayServer.Data.StoreData", "Store")
|
||||||
|
.WithMany("PayoutProcessors")
|
||||||
|
.HasForeignKey("StoreId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.Navigation("Store");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BTCPayServer.Data.Fido2Credential", b =>
|
modelBuilder.Entity("BTCPayServer.Data.Fido2Credential", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
|
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
|
||||||
|
@ -1308,16 +1361,6 @@ namespace BTCPayServer.Migrations
|
||||||
b.Navigation("Webhook");
|
b.Navigation("Webhook");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BTCPayServer.PayoutProcessors.PayoutProcessorData", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("BTCPayServer.Data.StoreData", "Store")
|
|
||||||
.WithMany("PayoutProcessors")
|
|
||||||
.HasForeignKey("StoreId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
b.Navigation("Store");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||||
|
@ -1414,6 +1457,8 @@ namespace BTCPayServer.Migrations
|
||||||
|
|
||||||
b.Navigation("Apps");
|
b.Navigation("Apps");
|
||||||
|
|
||||||
|
b.Navigation("CustodianAccounts");
|
||||||
|
|
||||||
b.Navigation("Invoices");
|
b.Navigation("Invoices");
|
||||||
|
|
||||||
b.Navigation("LightningAddresses");
|
b.Navigation("LightningAddresses");
|
||||||
|
@ -1422,12 +1467,12 @@ namespace BTCPayServer.Migrations
|
||||||
|
|
||||||
b.Navigation("PaymentRequests");
|
b.Navigation("PaymentRequests");
|
||||||
|
|
||||||
|
b.Navigation("PayoutProcessors");
|
||||||
|
|
||||||
b.Navigation("Payouts");
|
b.Navigation("Payouts");
|
||||||
|
|
||||||
b.Navigation("PullPayments");
|
b.Navigation("PullPayments");
|
||||||
|
|
||||||
b.Navigation("PayoutProcessors");
|
|
||||||
|
|
||||||
b.Navigation("UserStores");
|
b.Navigation("UserStores");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue