study-lib-backend/Migrations/20201212153903_SubjectDeleteRequests.cs
2020-12-13 01:23:12 +01:00

41 lines
1.5 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
namespace StudyLib.Migrations
{
public partial class SubjectDeleteRequests : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SubjectDeleteRequests",
columns: table => new
{
ID = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SubjectId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SubjectDeleteRequests", x => x.ID);
table.ForeignKey(
name: "FK_SubjectDeleteRequests_Subjects_SubjectId",
column: x => x.SubjectId,
principalTable: "Subjects",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SubjectDeleteRequests_SubjectId",
table: "SubjectDeleteRequests",
column: "SubjectId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SubjectDeleteRequests");
}
}
}