add migration

This commit is contained in:
Kukks
2020-10-07 11:08:11 +02:00
parent 2147f8ec8b
commit 9ff93ac2d5
2 changed files with 51 additions and 2 deletions

View File

@@ -0,0 +1,47 @@
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20201007090617_u2fDeviceCascade")]
public partial class u2fDeviceCascade : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
if (this.SupportDropForeignKey(migrationBuilder.ActiveProvider))
{
migrationBuilder.DropForeignKey(
name: "FK_U2FDevices_AspNetUsers_ApplicationUserId",
table: "U2FDevices");
migrationBuilder.AddForeignKey(
name: "FK_U2FDevices_AspNetUsers_ApplicationUserId",
table: "U2FDevices",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
protected override void Down(MigrationBuilder migrationBuilder)
{
if (this.SupportDropForeignKey(migrationBuilder.ActiveProvider))
{
migrationBuilder.DropForeignKey(
name: "FK_U2FDevices_AspNetUsers_ApplicationUserId",
table: "U2FDevices");
migrationBuilder.AddForeignKey(
name: "FK_U2FDevices_AspNetUsers_ApplicationUserId",
table: "U2FDevices",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}
}

View File

@@ -525,7 +525,8 @@ namespace BTCPayServer.Migrations
.HasColumnType("TEXT");
b.Property<string>("PullPaymentDataId")
.HasColumnType("TEXT");
.HasColumnType("TEXT")
.HasMaxLength(30);
b.HasKey("InvoiceDataId", "PullPaymentDataId");
@@ -960,7 +961,8 @@ namespace BTCPayServer.Migrations
{
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
.WithMany("U2FDevices")
.HasForeignKey("ApplicationUserId");
.HasForeignKey("ApplicationUserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.UserStore", b =>