51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Fix : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
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);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(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");
|
|
}
|
|
}
|
|
}
|