Database Migration: Removing migration with wrong table name and refreshing

This commit is contained in:
rockstardev 2020-12-28 16:52:21 -06:00
parent a588c72e6c
commit 8ae4315d43
3 changed files with 1214 additions and 100 deletions

View file

@ -1,87 +0,0 @@
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20201228223651_RenamingInvoiceSearchDataToFollowConvention")]
public partial class RenamingInvoiceSearchDataToFollowConvention : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceSearchDatas_Invoices_InvoiceDataId",
table: "InvoiceSearchDatas");
migrationBuilder.DropPrimaryKey(
name: "PK_InvoiceSearchDatas",
table: "InvoiceSearchDatas");
migrationBuilder.RenameTable(
name: "InvoiceSearchDatas",
newName: "InvoiceSearches");
migrationBuilder.RenameIndex(
name: "IX_InvoiceSearchDatas_Value",
table: "InvoiceSearches",
newName: "IX_InvoiceSearches_Value");
migrationBuilder.RenameIndex(
name: "IX_InvoiceSearchDatas_InvoiceDataId",
table: "InvoiceSearches",
newName: "IX_InvoiceSearches_InvoiceDataId");
migrationBuilder.AddPrimaryKey(
name: "PK_InvoiceSearches",
table: "InvoiceSearches",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceSearches_Invoices_InvoiceDataId",
table: "InvoiceSearches",
column: "InvoiceDataId",
principalTable: "Invoices",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceSearches_Invoices_InvoiceDataId",
table: "InvoiceSearches");
migrationBuilder.DropPrimaryKey(
name: "PK_InvoiceSearches",
table: "InvoiceSearches");
migrationBuilder.RenameTable(
name: "InvoiceSearches",
newName: "InvoiceSearchDatas");
migrationBuilder.RenameIndex(
name: "IX_InvoiceSearches_Value",
table: "InvoiceSearchDatas",
newName: "IX_InvoiceSearchDatas_Value");
migrationBuilder.RenameIndex(
name: "IX_InvoiceSearches_InvoiceDataId",
table: "InvoiceSearchDatas",
newName: "IX_InvoiceSearchDatas_InvoiceDataId");
migrationBuilder.AddPrimaryKey(
name: "PK_InvoiceSearchDatas",
table: "InvoiceSearchDatas",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceSearchDatas_Invoices_InvoiceDataId",
table: "InvoiceSearchDatas",
column: "InvoiceDataId",
principalTable: "Invoices",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,18 +1,14 @@
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20201227165824_AdddingInvoiceSearchData")]
public partial class AdddingInvoiceSearchData : Migration
public partial class AddingInvoiceSearchesTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InvoiceSearchDatas",
name: "InvoiceSearches",
columns: table => new
{
Id = table.Column<int>(nullable: false)
@ -26,9 +22,9 @@ namespace BTCPayServer.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_InvoiceSearchDatas", x => x.Id);
table.PrimaryKey("PK_InvoiceSearches", x => x.Id);
table.ForeignKey(
name: "FK_InvoiceSearchDatas_Invoices_InvoiceDataId",
name: "FK_InvoiceSearches_Invoices_InvoiceDataId",
column: x => x.InvoiceDataId,
principalTable: "Invoices",
principalColumn: "Id",
@ -36,20 +32,20 @@ namespace BTCPayServer.Migrations
});
migrationBuilder.CreateIndex(
name: "IX_InvoiceSearchDatas_InvoiceDataId",
table: "InvoiceSearchDatas",
name: "IX_InvoiceSearches_InvoiceDataId",
table: "InvoiceSearches",
column: "InvoiceDataId");
migrationBuilder.CreateIndex(
name: "IX_InvoiceSearchDatas_Value",
table: "InvoiceSearchDatas",
name: "IX_InvoiceSearches_Value",
table: "InvoiceSearches",
column: "Value");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InvoiceSearchDatas");
name: "InvoiceSearches");
}
}
}