relation test (collection)

This commit is contained in:
2023-08-28 13:30:53 +09:00
parent 1c98b870d8
commit d632b3abba
8 changed files with 437 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebAPI.Migrations
{
/// <inheritdoc />
public partial class bookreview2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Reviews_Books_BookId",
table: "Reviews");
migrationBuilder.AlterColumn<int>(
name: "BookId",
table: "Reviews",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Reviews_Books_BookId",
table: "Reviews",
column: "BookId",
principalTable: "Books",
principalColumn: "BookId",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Reviews_Books_BookId",
table: "Reviews");
migrationBuilder.AlterColumn<int>(
name: "BookId",
table: "Reviews",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_Reviews_Books_BookId",
table: "Reviews",
column: "BookId",
principalTable: "Books",
principalColumn: "BookId");
}
}
}