eFormCore/Migrations/20200318150742_MakingUnitIdNullableForAnswers.cs
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microting.eForm.Migrations
{
public partial class MakingUnitIdNullableForAnswers : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_answers_units_UnitId",
table: "answers");
migrationBuilder.AlterColumn<int>(
name: "UnitId",
table: "answers",
nullable: true,
oldClrType: typeof(int));
migrationBuilder.AlterColumn<int>(
name: "UnitId",
table: "answer_versions",
nullable: true,
oldClrType: typeof(int));
migrationBuilder.AddForeignKey(
name: "FK_answers_units_UnitId",
table: "answers",
column: "UnitId",
principalTable: "units",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_answers_units_UnitId",
table: "answers");
migrationBuilder.AlterColumn<int>(
name: "UnitId",
table: "answers",
nullable: false,
oldClrType: typeof(int),
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "UnitId",
table: "answer_versions",
nullable: false,
oldClrType: typeof(int),
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_answers_units_UnitId",
table: "answers",
column: "UnitId",
principalTable: "units",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}