40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace EntityFrameworkCore.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddTeamToLeagueRelationship : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Teams_LeagueId",
|
|
table: "Teams",
|
|
column: "LeagueId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Teams_Leagues_LeagueId",
|
|
table: "Teams",
|
|
column: "LeagueId",
|
|
principalTable: "Leagues",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Teams_Leagues_LeagueId",
|
|
table: "Teams");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Teams_LeagueId",
|
|
table: "Teams");
|
|
}
|
|
}
|
|
}
|