using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ManagerService.Migrations { /// public partial class AddEventMapFeaturesAndListView : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { // Add BaseSectionMapId to Sections table (SectionEvent → SectionMap link) migrationBuilder.AddColumn( 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( 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( name: "IsListViewEnabled", table: "Sections", type: "boolean", nullable: true, defaultValue: false); } /// 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"); } } }