I18NCommander/I18N Commander/DataModel/Migrations/20220626195157_202206MadeParentNullable.cs
Thorsten Sommer c90d3fdd3c
Changed section data model
- Made parents nullable
- Added a data key for the tree
- Added depth for quicker layer-wise loading
2022-07-09 15:03:18 +02:00

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);
}
}
}