50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace TournamentOrganizer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddTeamLeader : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "LeaderId",
|
|
table: "Teams",
|
|
type: "INTEGER",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Teams_LeaderId",
|
|
table: "Teams",
|
|
column: "LeaderId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Teams_Players_LeaderId",
|
|
table: "Teams",
|
|
column: "LeaderId",
|
|
principalTable: "Players",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Teams_Players_LeaderId",
|
|
table: "Teams");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Teams_LeaderId",
|
|
table: "Teams");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LeaderId",
|
|
table: "Teams");
|
|
}
|
|
}
|
|
}
|