Folders can now contain other folders, to arbitrary depth, via a self-referencing parent_folder_id (ON DELETE SET NULL, same pattern as lists.folder_id). Nesting/un-nesting is drag-and-drop only: dropping a folder onto another folder's header middle moves it in, the outer quarters or any top-level/in-folder drop insert it beside a target. Dropping a folder into itself or one of its own subfolders is silently ignored. Deleting a folder releases its lists and subfolders back to the top level, unchanged from the existing list behavior. ListFolderNavItemViewModel.Lists became Children (object, mixing lists and subfolders, mirroring TopLevel) so the existing implicit, type-matched DataTemplates render nested folders recursively without new XAML, and each nesting level gets its indent for free from the folder template's own margin. Folders/RootLists/ContainerOf/PersistOrderAsync/RecomputeFolderCounts now walk the tree instead of assuming one level. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ClaudeDo.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddNestedListFolders : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "parent_folder_id",
|
|
table: "list_folders",
|
|
type: "TEXT",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "idx_list_folders_parent",
|
|
table: "list_folders",
|
|
column: "parent_folder_id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_list_folders_list_folders_parent_folder_id",
|
|
table: "list_folders",
|
|
column: "parent_folder_id",
|
|
principalTable: "list_folders",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_list_folders_list_folders_parent_folder_id",
|
|
table: "list_folders");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "idx_list_folders_parent",
|
|
table: "list_folders");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "parent_folder_id",
|
|
table: "list_folders");
|
|
}
|
|
}
|
|
}
|