初始化
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FutureMailAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixDuplicateForeignKeys : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ReceivedMails_Users_RecipientId1",
|
||||
table: "ReceivedMails");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SentMails_Users_RecipientId1",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SentMails_RecipientId1",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ReceivedMails_RecipientId1",
|
||||
table: "ReceivedMails");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RecipientId1",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RecipientId1",
|
||||
table: "ReceivedMails");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RecipientId1",
|
||||
table: "SentMails",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RecipientId1",
|
||||
table: "ReceivedMails",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SentMails_RecipientId1",
|
||||
table: "SentMails",
|
||||
column: "RecipientId1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReceivedMails_RecipientId1",
|
||||
table: "ReceivedMails",
|
||||
column: "RecipientId1");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ReceivedMails_Users_RecipientId1",
|
||||
table: "ReceivedMails",
|
||||
column: "RecipientId1",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SentMails_Users_RecipientId1",
|
||||
table: "SentMails",
|
||||
column: "RecipientId1",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user