66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Yavsc.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class EnforceBlogAuthorFKs : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_BlogSpot_AspNetUsers_AuthorId",
|
|
table: "BlogSpot");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Comment_AspNetUsers_AuthorId",
|
|
table: "Comment");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_BlogSpot_AspNetUsers_AuthorId",
|
|
table: "BlogSpot",
|
|
column: "AuthorId",
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Comment_AspNetUsers_AuthorId",
|
|
table: "Comment",
|
|
column: "AuthorId",
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_BlogSpot_AspNetUsers_AuthorId",
|
|
table: "BlogSpot");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Comment_AspNetUsers_AuthorId",
|
|
table: "Comment");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_BlogSpot_AspNetUsers_AuthorId",
|
|
table: "BlogSpot",
|
|
column: "AuthorId",
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Comment_AspNetUsers_AuthorId",
|
|
table: "Comment",
|
|
column: "AuthorId",
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|