Sidebar folders get their own table rather than a flag on lists, so the places that enumerate lists (MCP tools, move-to-list, queue picker, repo import) need no folder filtering. ON DELETE SET NULL keeps a folder's lists alive when the folder goes.
75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ClaudeDo.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddListFolders : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "folder_id",
|
|
table: "lists",
|
|
type: "TEXT",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "list_folders",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<string>(type: "TEXT", nullable: false),
|
|
name = table.Column<string>(type: "TEXT", nullable: false),
|
|
created_at = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
icon = table.Column<string>(type: "TEXT", nullable: true),
|
|
sort_order = table.Column<int>(type: "INTEGER", nullable: false, defaultValue: 0),
|
|
is_collapsed = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_list_folders", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "idx_lists_folder",
|
|
table: "lists",
|
|
column: "folder_id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "idx_list_folders_sort",
|
|
table: "list_folders",
|
|
column: "sort_order");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_lists_list_folders_folder_id",
|
|
table: "lists",
|
|
column: "folder_id",
|
|
principalTable: "list_folders",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_lists_list_folders_folder_id",
|
|
table: "lists");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "list_folders");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "idx_lists_folder",
|
|
table: "lists");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "folder_id",
|
|
table: "lists");
|
|
}
|
|
}
|
|
}
|