- Made parents nullable - Added a data key for the tree - Added depth for quicker layer-wise loading
57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace DataModel.Migrations
|
|
{
|
|
public partial class _202206MadeParentNullable : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Sections_Sections_ParentId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "ParentId",
|
|
table: "Sections",
|
|
type: "INTEGER",
|
|
nullable: true,
|
|
oldClrType: typeof(int),
|
|
oldType: "INTEGER");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Sections_Sections_ParentId",
|
|
table: "Sections",
|
|
column: "ParentId",
|
|
principalTable: "Sections",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Sections_Sections_ParentId",
|
|
table: "Sections");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "ParentId",
|
|
table: "Sections",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "INTEGER",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Sections_Sections_ParentId",
|
|
table: "Sections",
|
|
column: "ParentId",
|
|
principalTable: "Sections",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|