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( name: "RankEntryId", table: "RankTowerEntry", type: "integer", nullable: false, defaultValue: 0, oldClrType: typeof(int), oldType: "integer", oldNullable: true); migrationBuilder.AlterColumn( 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( name: "RankEntryId", table: "RankTowerEntry", type: "integer", nullable: true, oldClrType: typeof(int), oldType: "integer"); migrationBuilder.AlterColumn( 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); } } }