study-lib-backend/Migrations/20201211232655_TestsChange.cs

74 lines
2.3 KiB
C#
Raw Normal View History

2020-12-12 14:47:20 +01:00
using Microsoft.EntityFrameworkCore.Migrations;
namespace StudyLib.Migrations
{
public partial class TestsChange : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MinorExams_Subjects_SubjectId",
table: "MinorExams");
migrationBuilder.DropPrimaryKey(
name: "PK_MinorExams",
table: "MinorExams");
migrationBuilder.RenameTable(
name: "MinorExams",
newName: "Tests");
migrationBuilder.RenameIndex(
name: "IX_MinorExams_SubjectId",
table: "Tests",
newName: "IX_Tests_SubjectId");
migrationBuilder.AddPrimaryKey(
name: "PK_Tests",
table: "Tests",
column: "ID");
migrationBuilder.AddForeignKey(
name: "FK_Tests_Subjects_SubjectId",
table: "Tests",
column: "SubjectId",
principalTable: "Subjects",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Tests_Subjects_SubjectId",
table: "Tests");
migrationBuilder.DropPrimaryKey(
name: "PK_Tests",
table: "Tests");
migrationBuilder.RenameTable(
name: "Tests",
newName: "MinorExams");
migrationBuilder.RenameIndex(
name: "IX_Tests_SubjectId",
table: "MinorExams",
newName: "IX_MinorExams_SubjectId");
migrationBuilder.AddPrimaryKey(
name: "PK_MinorExams",
table: "MinorExams",
column: "ID");
migrationBuilder.AddForeignKey(
name: "FK_MinorExams_Subjects_SubjectId",
table: "MinorExams",
column: "SubjectId",
principalTable: "Subjects",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}
}
}