Libation/DataLayer/UNTESTED/Migrations/20190124190057_NonNullCategory.cs
2019-10-04 16:14:04 -04:00

51 lines
1.6 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
namespace DataLayer.Migrations
{
public partial class NonNullCategory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Books_Categories_CategoryId",
table: "Books");
migrationBuilder.AlterColumn<int>(
name: "CategoryId",
table: "Books",
nullable: false,
oldClrType: typeof(int),
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Books_Categories_CategoryId",
table: "Books",
column: "CategoryId",
principalTable: "Categories",
principalColumn: "CategoryId",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Books_Categories_CategoryId",
table: "Books");
migrationBuilder.AlterColumn<int>(
name: "CategoryId",
table: "Books",
nullable: true,
oldClrType: typeof(int));
migrationBuilder.AddForeignKey(
name: "FK_Books_Categories_CategoryId",
table: "Books",
column: "CategoryId",
principalTable: "Categories",
principalColumn: "CategoryId",
onDelete: ReferentialAction.Restrict);
}
}
}