diff --git a/BTCPayServer.Data/Data/NotificationData.cs b/BTCPayServer.Data/Data/NotificationData.cs index a54afb521..826ce7580 100644 --- a/BTCPayServer.Data/Data/NotificationData.cs +++ b/BTCPayServer.Data/Data/NotificationData.cs @@ -14,9 +14,11 @@ namespace BTCPayServer.Data public string Id { get; set; } public DateTimeOffset Created { get; set; } [MaxLength(50)] + [Required] public string ApplicationUserId { get; set; } public ApplicationUser ApplicationUser { get; set; } [MaxLength(100)] + [Required] public string NotificationType { get; set; } public bool Seen { get; set; } public byte[] Blob { get; set; } diff --git a/BTCPayServer.Data/Migrations/20200614002524_AddNotificationDataEntity.cs b/BTCPayServer.Data/Migrations/20200614002524_AddNotificationDataEntity.cs deleted file mode 100644 index 8f6153ef4..000000000 --- a/BTCPayServer.Data/Migrations/20200614002524_AddNotificationDataEntity.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace BTCPayServer.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200614002524_AddNotificationDataEntity")] - public partial class AddNotificationDataEntity : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Notifications", - columns: table => new - { - Id = table.Column(maxLength: 36, nullable: false), - Created = table.Column(nullable: false), - ApplicationUserId = table.Column(maxLength: 50, nullable: true), - NotificationType = table.Column(maxLength: 100, nullable: true), - Seen = table.Column(nullable: false), - Blob = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Notifications", x => x.Id); - table.ForeignKey( - name: "FK_Notifications_AspNetUsers_ApplicationUserId", - column: x => x.ApplicationUserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Notifications_ApplicationUserId", - table: "Notifications", - column: "ApplicationUserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Notifications"); - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200623042347_pullpayments.cs b/BTCPayServer.Data/Migrations/20200623042347_pullpayments.cs deleted file mode 100644 index 71355c569..000000000 --- a/BTCPayServer.Data/Migrations/20200623042347_pullpayments.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace BTCPayServer.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200623042347_pullpayments")] - public partial class pullpayments : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "PullPayments", - columns: table => new - { - Id = table.Column(maxLength: 30, nullable: false), - StoreId = table.Column(maxLength: 50, nullable: true), - Period = table.Column(nullable: true), - StartDate = table.Column(nullable: false), - EndDate = table.Column(nullable: true), - Archived = table.Column(nullable: false), - Blob = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PullPayments", x => x.Id); - table.ForeignKey( - name: "FK_PullPayments_Stores_StoreId", - column: x => x.StoreId, - principalTable: "Stores", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Payouts", - columns: table => new - { - Id = table.Column(maxLength: 30, nullable: false), - Date = table.Column(nullable: false), - PullPaymentDataId = table.Column(nullable: true), - State = table.Column(maxLength: 20, nullable: false), - PaymentMethodId = table.Column(maxLength: 20, nullable: false), - Destination = table.Column(nullable: true), - Blob = table.Column(nullable: true), - Proof = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Payouts", x => x.Id); - table.ForeignKey( - name: "FK_Payouts_PullPayments_PullPaymentDataId", - column: x => x.PullPaymentDataId, - principalTable: "PullPayments", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Payouts_Destination", - table: "Payouts", - column: "Destination", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Payouts_PullPaymentDataId", - table: "Payouts", - column: "PullPaymentDataId"); - - migrationBuilder.CreateIndex( - name: "IX_Payouts_State", - table: "Payouts", - column: "State"); - - migrationBuilder.CreateIndex( - name: "IX_PullPayments_StoreId", - table: "PullPayments", - column: "StoreId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Payouts"); - - migrationBuilder.DropTable( - name: "PullPayments"); - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200624051926_invoicerefund.cs b/BTCPayServer.Data/Migrations/20200624051926_invoicerefund.cs deleted file mode 100644 index 8ef93eecf..000000000 --- a/BTCPayServer.Data/Migrations/20200624051926_invoicerefund.cs +++ /dev/null @@ -1,49 +0,0 @@ -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace BTCPayServer.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200624051926_invoicerefund")] - public partial class invoicerefund : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "PullPaymentDataId", - table: "Invoices", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Invoices_PullPaymentDataId", - table: "Invoices", - column: "PullPaymentDataId"); - if (this.SupportAddForeignKey(migrationBuilder.ActiveProvider)) - { - migrationBuilder.AddForeignKey( - name: "FK_Invoices_PullPayments_PullPaymentDataId", - table: "Invoices", - column: "PullPaymentDataId", - principalTable: "PullPayments", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Invoices_PullPayments_PullPaymentDataId", - table: "Invoices"); - - migrationBuilder.DropIndex( - name: "IX_Invoices_PullPaymentDataId", - table: "Invoices"); - - migrationBuilder.DropColumn( - name: "PullPaymentDataId", - table: "Invoices"); - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200625043042_removeoldrefund.cs b/BTCPayServer.Data/Migrations/20200625043042_removeoldrefund.cs deleted file mode 100644 index 75b16a05b..000000000 --- a/BTCPayServer.Data/Migrations/20200625043042_removeoldrefund.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace BTCPayServer.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200625043042_removeoldrefund")] - public partial class removeoldrefund : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "RefundAddresses"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "RefundAddresses", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Blob = table.Column(type: "BLOB", nullable: true), - InvoiceDataId = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_RefundAddresses", x => x.Id); - table.ForeignKey( - name: "FK_RefundAddresses_Invoices_InvoiceDataId", - column: x => x.InvoiceDataId, - principalTable: "Invoices", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_RefundAddresses_InvoiceDataId", - table: "RefundAddresses", - column: "InvoiceDataId"); - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200625050738_refundinvoice2.Designer.cs b/BTCPayServer.Data/Migrations/20200625050738_refundinvoice2.Designer.cs deleted file mode 100644 index 1ab7331a7..000000000 --- a/BTCPayServer.Data/Migrations/20200625050738_refundinvoice2.Designer.cs +++ /dev/null @@ -1,1039 +0,0 @@ -// -using System; -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace BTCPayServer.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200625050738_refundinvoice2")] - partial class refundinvoice2 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.4"); - - modelBuilder.Entity("BTCPayServer.Data.APIKeyData", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(50); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("Label") - .HasColumnType("TEXT"); - - b.Property("StoreId") - .HasColumnType("TEXT") - .HasMaxLength(50); - - b.Property("Type") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT") - .HasMaxLength(50); - - b.HasKey("Id"); - - b.HasIndex("StoreId"); - - b.HasIndex("UserId"); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("BTCPayServer.Data.AddressInvoiceData", b => - { - b.Property("Address") - .HasColumnType("TEXT"); - - b.Property("CreatedTime") - .HasColumnType("TEXT"); - - b.Property("InvoiceDataId") - .HasColumnType("TEXT"); - - b.HasKey("Address"); - - b.HasIndex("InvoiceDataId"); - - b.ToTable("AddressInvoices"); - }); - - modelBuilder.Entity("BTCPayServer.Data.AppData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AppType") - .HasColumnType("TEXT"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Settings") - .HasColumnType("TEXT"); - - b.Property("StoreDataId") - .HasColumnType("TEXT"); - - b.Property("TagAllInvoices") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("StoreDataId"); - - b.ToTable("Apps"); - }); - - modelBuilder.Entity("BTCPayServer.Data.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("RequiresEmailConfirmation") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("BTCPayServer.Data.HistoricalAddressInvoiceData", b => - { - b.Property("InvoiceDataId") - .HasColumnType("TEXT"); - - b.Property("Address") - .HasColumnType("TEXT"); - - b.Property("Assigned") - .HasColumnType("TEXT"); - - b.Property("CryptoCode") - .HasColumnType("TEXT"); - - b.Property("UnAssigned") - .HasColumnType("TEXT"); - - b.HasKey("InvoiceDataId", "Address"); - - b.ToTable("HistoricalAddressInvoices"); - }); - - modelBuilder.Entity("BTCPayServer.Data.InvoiceData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Archived") - .HasColumnType("INTEGER"); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("CustomerEmail") - .HasColumnType("TEXT"); - - b.Property("ExceptionStatus") - .HasColumnType("TEXT"); - - b.Property("ItemCode") - .HasColumnType("TEXT"); - - b.Property("OrderId") - .HasColumnType("TEXT"); - - b.Property("PullPaymentDataId") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("TEXT"); - - b.Property("StoreDataId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("PullPaymentDataId"); - - b.HasIndex("StoreDataId"); - - b.ToTable("Invoices"); - }); - - modelBuilder.Entity("BTCPayServer.Data.InvoiceEventData", b => - { - b.Property("InvoiceDataId") - .HasColumnType("TEXT"); - - b.Property("UniqueId") - .HasColumnType("TEXT"); - - b.Property("Message") - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.HasKey("InvoiceDataId", "UniqueId"); - - b.ToTable("InvoiceEvents"); - }); - - modelBuilder.Entity("BTCPayServer.Data.NotificationData", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(36); - - b.Property("ApplicationUserId") - .HasColumnType("TEXT") - .HasMaxLength(50); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("Created") - .HasColumnType("TEXT"); - - b.Property("NotificationType") - .HasColumnType("TEXT") - .HasMaxLength(100); - - b.Property("Seen") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("Notifications"); - }); - - modelBuilder.Entity("BTCPayServer.Data.OffchainTransactionData", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(64); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.HasKey("Id"); - - b.ToTable("OffchainTransactions"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Label") - .HasColumnType("TEXT"); - - b.Property("PairingTime") - .HasColumnType("TEXT"); - - b.Property("SIN") - .HasColumnType("TEXT"); - - b.Property("StoreDataId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SIN"); - - b.HasIndex("StoreDataId"); - - b.ToTable("PairedSINData"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PairingCodeData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("DateCreated") - .HasColumnType("TEXT"); - - b.Property("Expiration") - .HasColumnType("TEXT"); - - b.Property("Facade") - .HasColumnType("TEXT"); - - b.Property("Label") - .HasColumnType("TEXT"); - - b.Property("SIN") - .HasColumnType("TEXT"); - - b.Property("StoreDataId") - .HasColumnType("TEXT"); - - b.Property("TokenValue") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("PairingCodes"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PayjoinLock", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(100); - - b.HasKey("Id"); - - b.ToTable("PayjoinLocks"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PaymentData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Accounted") - .HasColumnType("INTEGER"); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("InvoiceDataId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("InvoiceDataId"); - - b.ToTable("Payments"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PaymentRequestData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Archived") - .HasColumnType("INTEGER"); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("Created") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.Property("StoreDataId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Status"); - - b.HasIndex("StoreDataId"); - - b.ToTable("PaymentRequests"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PayoutData", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(30); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("Destination") - .HasColumnType("TEXT"); - - b.Property("PaymentMethodId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(20); - - b.Property("Proof") - .HasColumnType("BLOB"); - - b.Property("PullPaymentDataId") - .HasColumnType("TEXT"); - - b.Property("State") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(20); - - b.HasKey("Id"); - - b.HasIndex("Destination") - .IsUnique(); - - b.HasIndex("PullPaymentDataId"); - - b.HasIndex("State"); - - b.ToTable("Payouts"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PendingInvoiceData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("PendingInvoices"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PlannedTransaction", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(100); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("BroadcastAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("PlannedTransactions"); - }); - - modelBuilder.Entity("BTCPayServer.Data.PullPaymentData", b => - { - b.Property("Id") - .HasColumnType("TEXT") - .HasMaxLength(30); - - b.Property("Archived") - .HasColumnType("INTEGER"); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("EndDate") - .HasColumnType("TEXT"); - - b.Property("Period") - .HasColumnType("INTEGER"); - - b.Property("StartDate") - .HasColumnType("TEXT"); - - b.Property("StoreId") - .HasColumnType("TEXT") - .HasMaxLength(50); - - b.HasKey("Id"); - - b.HasIndex("StoreId"); - - b.ToTable("PullPayments"); - }); - - modelBuilder.Entity("BTCPayServer.Data.RefundData", b => - { - b.Property("InvoiceDataId") - .HasColumnType("TEXT"); - - b.Property("PullPaymentDataId") - .HasColumnType("TEXT"); - - b.HasKey("InvoiceDataId", "PullPaymentDataId"); - - b.HasIndex("PullPaymentDataId"); - - b.ToTable("Refunds"); - }); - - modelBuilder.Entity("BTCPayServer.Data.SettingData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Settings"); - }); - - modelBuilder.Entity("BTCPayServer.Data.StoreData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("DefaultCrypto") - .HasColumnType("TEXT"); - - b.Property("DerivationStrategies") - .HasColumnType("TEXT"); - - b.Property("DerivationStrategy") - .HasColumnType("TEXT"); - - b.Property("SpeedPolicy") - .HasColumnType("INTEGER"); - - b.Property("StoreBlob") - .HasColumnType("BLOB"); - - b.Property("StoreCertificate") - .HasColumnType("BLOB"); - - b.Property("StoreName") - .HasColumnType("TEXT"); - - b.Property("StoreWebsite") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Stores"); - }); - - modelBuilder.Entity("BTCPayServer.Data.StoredFile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("ApplicationUserId") - .HasColumnType("TEXT"); - - b.Property("FileName") - .HasColumnType("TEXT"); - - b.Property("StorageFileName") - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("Files"); - }); - - modelBuilder.Entity("BTCPayServer.Data.U2FDevice", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ApplicationUserId") - .HasColumnType("TEXT"); - - b.Property("AttestationCert") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Counter") - .HasColumnType("INTEGER"); - - b.Property("KeyHandle") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("PublicKey") - .IsRequired() - .HasColumnType("BLOB"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("U2FDevices"); - }); - - modelBuilder.Entity("BTCPayServer.Data.UserStore", b => - { - b.Property("ApplicationUserId") - .HasColumnType("TEXT"); - - b.Property("StoreDataId") - .HasColumnType("TEXT"); - - b.Property("Role") - .HasColumnType("TEXT"); - - b.HasKey("ApplicationUserId", "StoreDataId"); - - b.HasIndex("StoreDataId"); - - b.ToTable("UserStore"); - }); - - modelBuilder.Entity("BTCPayServer.Data.WalletData", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.HasKey("Id"); - - b.ToTable("Wallets"); - }); - - modelBuilder.Entity("BTCPayServer.Data.WalletTransactionData", b => - { - b.Property("WalletDataId") - .HasColumnType("TEXT"); - - b.Property("TransactionId") - .HasColumnType("TEXT"); - - b.Property("Blob") - .HasColumnType("BLOB"); - - b.Property("Labels") - .HasColumnType("TEXT"); - - b.HasKey("WalletDataId", "TransactionId"); - - b.ToTable("WalletTransactions"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("NormalizedName") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("BTCPayServer.Data.APIKeyData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("APIKeys") - .HasForeignKey("StoreId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("BTCPayServer.Data.ApplicationUser", "User") - .WithMany("APIKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.AddressInvoiceData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("AddressInvoices") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.AppData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("Apps") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.HistoricalAddressInvoiceData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("HistoricalAddressInvoices") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("BTCPayServer.Data.InvoiceData", b => - { - b.HasOne("BTCPayServer.Data.PullPaymentData", "PullPaymentData") - .WithMany() - .HasForeignKey("PullPaymentDataId"); - - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("Invoices") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.InvoiceEventData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("Events") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("BTCPayServer.Data.NotificationData", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("Notifications") - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("PairedSINs") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.PaymentData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("Payments") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.PaymentRequestData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("PaymentRequests") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.PayoutData", b => - { - b.HasOne("BTCPayServer.Data.PullPaymentData", "PullPaymentData") - .WithMany("Payouts") - .HasForeignKey("PullPaymentDataId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.PendingInvoiceData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("PendingInvoices") - .HasForeignKey("Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("BTCPayServer.Data.PullPaymentData", b => - { - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("PullPayments") - .HasForeignKey("StoreId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("BTCPayServer.Data.RefundData", b => - { - b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData") - .WithMany("Refunds") - .HasForeignKey("InvoiceDataId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("BTCPayServer.Data.PullPaymentData", "PullPaymentData") - .WithMany() - .HasForeignKey("PullPaymentDataId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("BTCPayServer.Data.StoredFile", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("StoredFiles") - .HasForeignKey("ApplicationUserId"); - }); - - modelBuilder.Entity("BTCPayServer.Data.U2FDevice", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("U2FDevices") - .HasForeignKey("ApplicationUserId"); - }); - - modelBuilder.Entity("BTCPayServer.Data.UserStore", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") - .WithMany("UserStores") - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("BTCPayServer.Data.StoreData", "StoreData") - .WithMany("UserStores") - .HasForeignKey("StoreDataId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("BTCPayServer.Data.WalletTransactionData", b => - { - b.HasOne("BTCPayServer.Data.WalletData", "WalletData") - .WithMany("WalletTransactions") - .HasForeignKey("WalletDataId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("BTCPayServer.Data.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("BTCPayServer.Data.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200625050738_refundinvoice2.cs b/BTCPayServer.Data/Migrations/20200625050738_refundinvoice2.cs deleted file mode 100644 index a18669898..000000000 --- a/BTCPayServer.Data/Migrations/20200625050738_refundinvoice2.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace BTCPayServer.Migrations -{ - public partial class refundinvoice2 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Refunds", - columns: table => new - { - InvoiceDataId = table.Column(nullable: false), - PullPaymentDataId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Refunds", x => new { x.InvoiceDataId, x.PullPaymentDataId }); - table.ForeignKey( - name: "FK_Refunds_Invoices_InvoiceDataId", - column: x => x.InvoiceDataId, - principalTable: "Invoices", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Refunds_PullPayments_PullPaymentDataId", - column: x => x.PullPaymentDataId, - principalTable: "PullPayments", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Refunds_PullPaymentDataId", - table: "Refunds", - column: "PullPaymentDataId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Refunds"); - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200625060941_refundinvoice3.cs b/BTCPayServer.Data/Migrations/20200625060941_refundinvoice3.cs deleted file mode 100644 index e1accb1fa..000000000 --- a/BTCPayServer.Data/Migrations/20200625060941_refundinvoice3.cs +++ /dev/null @@ -1,81 +0,0 @@ -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace BTCPayServer.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20200625060941_refundinvoice3")] - public partial class refundinvoice3 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - if (this.SupportDropForeignKey(migrationBuilder.ActiveProvider)) - migrationBuilder.DropForeignKey( - name: "FK_Invoices_PullPayments_PullPaymentDataId", - table: "Invoices"); - - migrationBuilder.DropIndex( - name: "IX_Invoices_PullPaymentDataId", - table: "Invoices"); - - if (this.SupportDropColumn(migrationBuilder.ActiveProvider)) - migrationBuilder.DropColumn( - name: "PullPaymentDataId", - table: "Invoices"); - - migrationBuilder.AddColumn( - name: "CurrentRefundId", - table: "Invoices", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Invoices_Id_CurrentRefundId", - table: "Invoices", - columns: new[] { "Id", "CurrentRefundId" }); - - if (this.SupportAddForeignKey(migrationBuilder.ActiveProvider)) - migrationBuilder.AddForeignKey( - name: "FK_Invoices_Refunds_Id_CurrentRefundId", - table: "Invoices", - columns: new[] { "Id", "CurrentRefundId" }, - principalTable: "Refunds", - principalColumns: new[] { "InvoiceDataId", "PullPaymentDataId" }, - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Invoices_Refunds_Id_CurrentRefundId", - table: "Invoices"); - - migrationBuilder.DropIndex( - name: "IX_Invoices_Id_CurrentRefundId", - table: "Invoices"); - - migrationBuilder.DropColumn( - name: "CurrentRefundId", - table: "Invoices"); - - migrationBuilder.AddColumn( - name: "PullPaymentDataId", - table: "Invoices", - type: "TEXT", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Invoices_PullPaymentDataId", - table: "Invoices", - column: "PullPaymentDataId"); - - migrationBuilder.AddForeignKey( - name: "FK_Invoices_PullPayments_PullPaymentDataId", - table: "Invoices", - column: "PullPaymentDataId", - principalTable: "PullPayments", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs b/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs new file mode 100644 index 000000000..8e13c1d31 --- /dev/null +++ b/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs @@ -0,0 +1,212 @@ +using System; +using BTCPayServer.Data; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace BTCPayServer.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20200625064111_refundnotificationpullpayments")] + public partial class refundnotificationpullpayments : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "RefundAddresses"); + + migrationBuilder.AddColumn( + name: "CurrentRefundId", + table: "Invoices", + nullable: true); + + migrationBuilder.CreateTable( + name: "Notifications", + columns: table => new + { + Id = table.Column(maxLength: 36, nullable: false), + Created = table.Column(nullable: false), + ApplicationUserId = table.Column(maxLength: 50, nullable: false), + NotificationType = table.Column(maxLength: 100, nullable: false), + Seen = table.Column(nullable: false), + Blob = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Notifications", x => x.Id); + table.ForeignKey( + name: "FK_Notifications_AspNetUsers_ApplicationUserId", + column: x => x.ApplicationUserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PullPayments", + columns: table => new + { + Id = table.Column(maxLength: 30, nullable: false), + StoreId = table.Column(maxLength: 50, nullable: true), + Period = table.Column(nullable: true), + StartDate = table.Column(nullable: false), + EndDate = table.Column(nullable: true), + Archived = table.Column(nullable: false), + Blob = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PullPayments", x => x.Id); + table.ForeignKey( + name: "FK_PullPayments_Stores_StoreId", + column: x => x.StoreId, + principalTable: "Stores", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Payouts", + columns: table => new + { + Id = table.Column(maxLength: 30, nullable: false), + Date = table.Column(nullable: false), + PullPaymentDataId = table.Column(nullable: true), + State = table.Column(maxLength: 20, nullable: false), + PaymentMethodId = table.Column(maxLength: 20, nullable: false), + Destination = table.Column(nullable: true), + Blob = table.Column(nullable: true), + Proof = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Payouts", x => x.Id); + table.ForeignKey( + name: "FK_Payouts_PullPayments_PullPaymentDataId", + column: x => x.PullPaymentDataId, + principalTable: "PullPayments", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Refunds", + columns: table => new + { + InvoiceDataId = table.Column(nullable: false), + PullPaymentDataId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Refunds", x => new { x.InvoiceDataId, x.PullPaymentDataId }); + table.ForeignKey( + name: "FK_Refunds_Invoices_InvoiceDataId", + column: x => x.InvoiceDataId, + principalTable: "Invoices", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Refunds_PullPayments_PullPaymentDataId", + column: x => x.PullPaymentDataId, + principalTable: "PullPayments", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Invoices_Id_CurrentRefundId", + table: "Invoices", + columns: new[] { "Id", "CurrentRefundId" }); + + migrationBuilder.CreateIndex( + name: "IX_Notifications_ApplicationUserId", + table: "Notifications", + column: "ApplicationUserId"); + + migrationBuilder.CreateIndex( + name: "IX_Payouts_Destination", + table: "Payouts", + column: "Destination", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Payouts_PullPaymentDataId", + table: "Payouts", + column: "PullPaymentDataId"); + + migrationBuilder.CreateIndex( + name: "IX_Payouts_State", + table: "Payouts", + column: "State"); + + migrationBuilder.CreateIndex( + name: "IX_PullPayments_StoreId", + table: "PullPayments", + column: "StoreId"); + + migrationBuilder.CreateIndex( + name: "IX_Refunds_PullPaymentDataId", + table: "Refunds", + column: "PullPaymentDataId"); + + if (this.SupportAddForeignKey(this.ActiveProvider)) + migrationBuilder.AddForeignKey( + name: "FK_Invoices_Refunds_Id_CurrentRefundId", + table: "Invoices", + columns: new[] { "Id", "CurrentRefundId" }, + principalTable: "Refunds", + principalColumns: new[] { "InvoiceDataId", "PullPaymentDataId" }, + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Invoices_Refunds_Id_CurrentRefundId", + table: "Invoices"); + + migrationBuilder.DropTable( + name: "Notifications"); + + migrationBuilder.DropTable( + name: "Payouts"); + + migrationBuilder.DropTable( + name: "Refunds"); + + migrationBuilder.DropTable( + name: "PullPayments"); + + migrationBuilder.DropIndex( + name: "IX_Invoices_Id_CurrentRefundId", + table: "Invoices"); + + migrationBuilder.DropColumn( + name: "CurrentRefundId", + table: "Invoices"); + + migrationBuilder.CreateTable( + name: "RefundAddresses", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Blob = table.Column(type: "BLOB", nullable: true), + InvoiceDataId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RefundAddresses", x => x.Id); + table.ForeignKey( + name: "FK_RefundAddresses_Invoices_InvoiceDataId", + column: x => x.InvoiceDataId, + principalTable: "Invoices", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_RefundAddresses_InvoiceDataId", + table: "RefundAddresses", + column: "InvoiceDataId"); + } + } +} diff --git a/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs b/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs index bc65c449f..7964d82b1 100644 --- a/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/BTCPayServer.Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -255,6 +255,7 @@ namespace BTCPayServer.Migrations .HasMaxLength(36); b.Property("ApplicationUserId") + .IsRequired() .HasColumnType("TEXT") .HasMaxLength(50); @@ -265,6 +266,7 @@ namespace BTCPayServer.Migrations .HasColumnType("TEXT"); b.Property("NotificationType") + .IsRequired() .HasColumnType("TEXT") .HasMaxLength(100); @@ -876,7 +878,8 @@ namespace BTCPayServer.Migrations b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser") .WithMany("Notifications") .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b =>