52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
|
||
|
|
namespace TournamentOrganizer.Migrations
|
||
|
|
{
|
||
|
|
/// <inheritdoc />
|
||
|
|
public partial class AddTournamentTeam : Migration
|
||
|
|
{
|
||
|
|
/// <inheritdoc />
|
||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||
|
|
{
|
||
|
|
migrationBuilder.CreateTable(
|
||
|
|
name: "TournamentTeams",
|
||
|
|
columns: table => new
|
||
|
|
{
|
||
|
|
TournamentId = table.Column<int>(type: "INTEGER", nullable: false),
|
||
|
|
TeamId = table.Column<int>(type: "INTEGER", nullable: false),
|
||
|
|
Seed = table.Column<int>(type: "INTEGER", nullable: false)
|
||
|
|
},
|
||
|
|
constraints: table =>
|
||
|
|
{
|
||
|
|
table.PrimaryKey("PK_TournamentTeams", x => new { x.TournamentId, x.TeamId });
|
||
|
|
table.ForeignKey(
|
||
|
|
name: "FK_TournamentTeams_Teams_TeamId",
|
||
|
|
column: x => x.TeamId,
|
||
|
|
principalTable: "Teams",
|
||
|
|
principalColumn: "Id",
|
||
|
|
onDelete: ReferentialAction.Cascade);
|
||
|
|
table.ForeignKey(
|
||
|
|
name: "FK_TournamentTeams_Tournaments_TournamentId",
|
||
|
|
column: x => x.TournamentId,
|
||
|
|
principalTable: "Tournaments",
|
||
|
|
principalColumn: "Id",
|
||
|
|
onDelete: ReferentialAction.Cascade);
|
||
|
|
});
|
||
|
|
|
||
|
|
migrationBuilder.CreateIndex(
|
||
|
|
name: "IX_TournamentTeams_TeamId",
|
||
|
|
table: "TournamentTeams",
|
||
|
|
column: "TeamId");
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <inheritdoc />
|
||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||
|
|
{
|
||
|
|
migrationBuilder.DropTable(
|
||
|
|
name: "TournamentTeams");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|