using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace TournamentOrganizer.Migrations { /// public partial class AddMatchBracketNavigation : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "LoserMatchId", table: "Matches", type: "INTEGER", nullable: true); migrationBuilder.AddColumn( name: "LoserSlot", table: "Matches", type: "INTEGER", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "WinnerMatchId", table: "Matches", type: "INTEGER", nullable: true); migrationBuilder.AddColumn( 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); } /// 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"); } } }