Files
API/TOOHUCardAPI/Migrations/20211107185734_cascade delete children.cs
2021-11-07 14:00:18 -05:00

98 lines
3.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
namespace TOOHUCardAPI.Migrations
{
public partial class cascadedeletechildren : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EncodedCardGroup_Users_UserSteamId",
table: "EncodedCardGroup");
migrationBuilder.DropForeignKey(
name: "FK_RankTowerEntry_RankEntries_RankEntryId",
table: "RankTowerEntry");
migrationBuilder.AlterColumn<int>(
name: "RankEntryId",
table: "RankTowerEntry",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AlterColumn<long>(
name: "UserSteamId",
table: "EncodedCardGroup",
type: "bigint",
nullable: false,
defaultValue: 0L,
oldClrType: typeof(long),
oldType: "bigint",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_EncodedCardGroup_Users_UserSteamId",
table: "EncodedCardGroup",
column: "UserSteamId",
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RankTowerEntry_RankEntries_RankEntryId",
table: "RankTowerEntry",
column: "RankEntryId",
principalTable: "RankEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EncodedCardGroup_Users_UserSteamId",
table: "EncodedCardGroup");
migrationBuilder.DropForeignKey(
name: "FK_RankTowerEntry_RankEntries_RankEntryId",
table: "RankTowerEntry");
migrationBuilder.AlterColumn<int>(
name: "RankEntryId",
table: "RankTowerEntry",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<long>(
name: "UserSteamId",
table: "EncodedCardGroup",
type: "bigint",
nullable: true,
oldClrType: typeof(long),
oldType: "bigint");
migrationBuilder.AddForeignKey(
name: "FK_EncodedCardGroup_Users_UserSteamId",
table: "EncodedCardGroup",
column: "UserSteamId",
principalTable: "Users",
principalColumn: "SteamId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RankTowerEntry_RankEntries_RankEntryId",
table: "RankTowerEntry",
column: "RankEntryId",
principalTable: "RankEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}