103 lines
3.1 KiB
C#
103 lines
3.1 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace TournamentOrganizer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddMatchBracketNavigation : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "LoserMatchId",
|
|
table: "Matches",
|
|
type: "INTEGER",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "LoserSlot",
|
|
table: "Matches",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WinnerMatchId",
|
|
table: "Matches",
|
|
type: "INTEGER",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "WinnerSlot",
|
|
table: "Matches",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Matches_LoserMatchId",
|
|
table: "Matches",
|
|
column: "LoserMatchId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Matches_WinnerMatchId",
|
|
table: "Matches",
|
|
column: "WinnerMatchId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Matches_Matches_LoserMatchId",
|
|
table: "Matches",
|
|
column: "LoserMatchId",
|
|
principalTable: "Matches",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Matches_Matches_WinnerMatchId",
|
|
table: "Matches",
|
|
column: "WinnerMatchId",
|
|
principalTable: "Matches",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Matches_Matches_LoserMatchId",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Matches_Matches_WinnerMatchId",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Matches_LoserMatchId",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Matches_WinnerMatchId",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LoserMatchId",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LoserSlot",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WinnerMatchId",
|
|
table: "Matches");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "WinnerSlot",
|
|
table: "Matches");
|
|
}
|
|
}
|
|
}
|