140 lines
4.7 KiB
C#
140 lines
4.7 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace StudyLib.Migrations
|
|
{
|
|
public partial class SubModelsUpdate : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Assignment_Subjects_SubjectID",
|
|
table: "Assignment");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Comment_Subjects_SubjectID",
|
|
table: "Comment");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_MinorExam_Subjects_SubjectID",
|
|
table: "MinorExam");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "SubjectID",
|
|
table: "MinorExam",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "SubjectID",
|
|
table: "Comment",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "SubjectID",
|
|
table: "Assignment",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Assignment_Subjects_SubjectID",
|
|
table: "Assignment",
|
|
column: "SubjectID",
|
|
principalTable: "Subjects",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Comment_Subjects_SubjectID",
|
|
table: "Comment",
|
|
column: "SubjectID",
|
|
principalTable: "Subjects",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_MinorExam_Subjects_SubjectID",
|
|
table: "MinorExam",
|
|
column: "SubjectID",
|
|
principalTable: "Subjects",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Assignment_Subjects_SubjectID",
|
|
table: "Assignment");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Comment_Subjects_SubjectID",
|
|
table: "Comment");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_MinorExam_Subjects_SubjectID",
|
|
table: "MinorExam");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "SubjectID",
|
|
table: "MinorExam",
|
|
type: "bigint",
|
|
nullable: true,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "SubjectID",
|
|
table: "Comment",
|
|
type: "bigint",
|
|
nullable: true,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint");
|
|
|
|
migrationBuilder.AlterColumn<long>(
|
|
name: "SubjectID",
|
|
table: "Assignment",
|
|
type: "bigint",
|
|
nullable: true,
|
|
oldClrType: typeof(long),
|
|
oldType: "bigint");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Assignment_Subjects_SubjectID",
|
|
table: "Assignment",
|
|
column: "SubjectID",
|
|
principalTable: "Subjects",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Comment_Subjects_SubjectID",
|
|
table: "Comment",
|
|
column: "SubjectID",
|
|
principalTable: "Subjects",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_MinorExam_Subjects_SubjectID",
|
|
table: "MinorExam",
|
|
column: "SubjectID",
|
|
principalTable: "Subjects",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
}
|
|
}
|