using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ClaudeDo.Data.Migrations
{
    /// <inheritdoc />
    public partial class AddSessionSkills : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "session_skills",
                table: "tasks",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "session_skills",
                table: "list_config",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "session_skills",
                table: "app_settings",
                type: "TEXT",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "session_skills",
                columns: table => new
                {
                    name = table.Column<string>(type: "TEXT", nullable: false),
                    source_url = table.Column<string>(type: "TEXT", nullable: false),
                    pinned_ref = table.Column<string>(type: "TEXT", nullable: false),
                    subpath = table.Column<string>(type: "TEXT", nullable: false),
                    description = table.Column<string>(type: "TEXT", nullable: false),
                    added_at = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_session_skills", x => x.name);
                });

            migrationBuilder.UpdateData(
                table: "app_settings",
                keyColumn: "id",
                keyValue: 1,
                column: "session_skills",
                value: null);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "session_skills");

            migrationBuilder.DropColumn(
                name: "session_skills",
                table: "tasks");

            migrationBuilder.DropColumn(
                name: "session_skills",
                table: "list_config");

            migrationBuilder.DropColumn(
                name: "session_skills",
                table: "app_settings");
        }
    }
}
