using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClaudeDo.Data.Migrations
{
///
public partial class AddListFolders : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "folder_id",
table: "lists",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "list_folders",
columns: table => new
{
id = table.Column(type: "TEXT", nullable: false),
name = table.Column(type: "TEXT", nullable: false),
created_at = table.Column(type: "TEXT", nullable: false),
icon = table.Column(type: "TEXT", nullable: true),
sort_order = table.Column(type: "INTEGER", nullable: false, defaultValue: 0),
is_collapsed = table.Column(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);
}
///
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");
}
}
}