using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Nexus.Api.Data;

#nullable disable

namespace Nexus.Api.Migrations
{
    /// <inheritdoc />
    [DbContext(typeof(NexusDbContext))]
    [Migration("20260618233002_AddActivityTaskReference")]
    public partial class AddActivityTaskReference : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.Sql(
                """
                ALTER TABLE "Activity"
                    ADD COLUMN IF NOT EXISTS "TaskId" uuid;

                CREATE INDEX IF NOT EXISTS "IX_Activity_TaskId"
                    ON "Activity" ("TaskId");
                """);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.Sql(
                """
                DROP INDEX IF EXISTS "IX_Activity_TaskId";
                ALTER TABLE "Activity"
                    DROP COLUMN IF EXISTS "TaskId";
                """);
        }
    }
}
