presence/data/Migrations/20241122130535_Fix.cs

51 lines
1.6 KiB
C#
Raw Normal View History

2024-11-26 05:09:12 +00:00
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");
}
}
}