using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFrameworkCore.Data.Migrations
{
///
public partial class MakeRelationshipLeagueToTeamNullable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Leagues_LeagueId",
table: "Teams");
migrationBuilder.AlterColumn(
name: "LeagueId",
table: "Teams",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 1,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 2,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 3,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 4,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 5,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 6,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 7,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 8,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 9,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 10,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 11,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 12,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 13,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 14,
column: "LeagueId",
value: null);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 15,
column: "LeagueId",
value: null);
migrationBuilder.AddForeignKey(
name: "FK_Teams_Leagues_LeagueId",
table: "Teams",
column: "LeagueId",
principalTable: "Leagues",
principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Leagues_LeagueId",
table: "Teams");
migrationBuilder.AlterColumn(
name: "LeagueId",
table: "Teams",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 1,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 2,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 3,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 4,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 5,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 6,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 7,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 8,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 9,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 10,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 11,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 12,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 13,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 14,
column: "LeagueId",
value: 0);
migrationBuilder.UpdateData(
table: "Teams",
keyColumn: "Id",
keyValue: 15,
column: "LeagueId",
value: 0);
migrationBuilder.AddForeignKey(
name: "FK_Teams_Leagues_LeagueId",
table: "Teams",
column: "LeagueId",
principalTable: "Leagues",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}