manager-service/ManagerService/Migrations/20260317120000_AddEventMapFeaturesAndListView.cs

95 lines
3.2 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class AddEventMapFeaturesAndListView : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// Add BaseSectionMapId to Sections table (SectionEvent → SectionMap link)
migrationBuilder.AddColumn<string>(
name: "BaseSectionMapId",
table: "Sections",
type: "text",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Sections_BaseSectionMapId",
table: "Sections",
column: "BaseSectionMapId");
migrationBuilder.AddForeignKey(
name: "FK_Sections_Sections_BaseSectionMapId",
table: "Sections",
column: "BaseSectionMapId",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
// Add SectionEventId to MapAnnotations (global event-level annotations)
migrationBuilder.AddColumn<string>(
name: "SectionEventId",
table: "MapAnnotations",
type: "text",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_MapAnnotations_SectionEventId",
table: "MapAnnotations",
column: "SectionEventId");
migrationBuilder.AddForeignKey(
name: "FK_MapAnnotations_Sections_SectionEventId",
table: "MapAnnotations",
column: "SectionEventId",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
// Add IsListViewEnabled to Sections table (SectionMap feature)
migrationBuilder.AddColumn<bool>(
name: "IsListViewEnabled",
table: "Sections",
type: "boolean",
nullable: true,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Sections_Sections_BaseSectionMapId",
table: "Sections");
migrationBuilder.DropIndex(
name: "IX_Sections_BaseSectionMapId",
table: "Sections");
migrationBuilder.DropColumn(
name: "BaseSectionMapId",
table: "Sections");
migrationBuilder.DropForeignKey(
name: "FK_MapAnnotations_Sections_SectionEventId",
table: "MapAnnotations");
migrationBuilder.DropIndex(
name: "IX_MapAnnotations_SectionEventId",
table: "MapAnnotations");
migrationBuilder.DropColumn(
name: "SectionEventId",
table: "MapAnnotations");
migrationBuilder.DropColumn(
name: "IsListViewEnabled",
table: "Sections");
}
}
}