Files
chapter-organizer/Data/Migrations/20250826155947_AddStudentEventRanking.cs
T

52 lines
1.9 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations
{
/// <inheritdoc />
public partial class AddStudentEventRanking : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StudentEventRanking",
columns: table => new
{
EventDefinitionId = table.Column<int>(type: "INTEGER", nullable: false),
StudentId = table.Column<int>(type: "INTEGER", nullable: false),
Rank = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StudentEventRanking", x => new { x.EventDefinitionId, x.StudentId });
table.ForeignKey(
name: "FK_StudentEventRanking_Events_EventDefinitionId",
column: x => x.EventDefinitionId,
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StudentEventRanking_Students_StudentId",
column: x => x.StudentId,
principalTable: "Students",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_StudentEventRanking_StudentId",
table: "StudentEventRanking",
column: "StudentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StudentEventRanking");
}
}
}