83 lines
2.6 KiB
C#
83 lines
2.6 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace data.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class FixIssueAgain : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_StudentGroupsSubjects_Students_StudentId",
|
|||
|
table: "StudentGroupsSubjects");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_StudentGroupsSubjects_StudentId",
|
|||
|
table: "StudentGroupsSubjects");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "StudentId",
|
|||
|
table: "StudentGroupsSubjects");
|
|||
|
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "StudentId",
|
|||
|
table: "Diaries",
|
|||
|
type: "integer",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0);
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Diaries_StudentId",
|
|||
|
table: "Diaries",
|
|||
|
column: "StudentId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Diaries_Students_StudentId",
|
|||
|
table: "Diaries",
|
|||
|
column: "StudentId",
|
|||
|
principalTable: "Students",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Diaries_Students_StudentId",
|
|||
|
table: "Diaries");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_Diaries_StudentId",
|
|||
|
table: "Diaries");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "StudentId",
|
|||
|
table: "Diaries");
|
|||
|
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "StudentId",
|
|||
|
table: "StudentGroupsSubjects",
|
|||
|
type: "integer",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0);
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_StudentGroupsSubjects_StudentId",
|
|||
|
table: "StudentGroupsSubjects",
|
|||
|
column: "StudentId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_StudentGroupsSubjects_Students_StudentId",
|
|||
|
table: "StudentGroupsSubjects",
|
|||
|
column: "StudentId",
|
|||
|
principalTable: "Students",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|