// ============================================================
// EF CORE MIGRATION TEMPLATE
// Generated by MORPH Framework
// ============================================================

using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace {{NAMESPACE}}.Infrastructure.Data.Migrations;

/// <inheritdoc />
public partial class Add{{pascalCase FEATURE_NAME}} : Migration
{
    /// <inheritdoc />
    protected override void Up(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.CreateTable(
            name: "{{pascalCase FEATURE_NAME}}s",
            columns: table => new
            {
                Id = table.Column<int>(type: "int", nullable: false)
                    .Annotation("SqlServer:Identity", "1, 1"),
                Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false,
                    defaultValueSql: "GETUTCDATE()"),
                UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
            },
            constraints: table =>
            {
                table.PrimaryKey("PK_{{pascalCase FEATURE_NAME}}s", x => x.Id);
            });

        // Indexes
        migrationBuilder.CreateIndex(
            name: "IX_{{pascalCase FEATURE_NAME}}s_Name",
            table: "{{pascalCase FEATURE_NAME}}s",
            column: "Name");

        migrationBuilder.CreateIndex(
            name: "IX_{{pascalCase FEATURE_NAME}}s_Status",
            table: "{{pascalCase FEATURE_NAME}}s",
            column: "Status");

        migrationBuilder.CreateIndex(
            name: "IX_{{pascalCase FEATURE_NAME}}s_CreatedAt",
            table: "{{pascalCase FEATURE_NAME}}s",
            column: "CreatedAt");
    }

    /// <inheritdoc />
    protected override void Down(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.DropTable(
            name: "{{pascalCase FEATURE_NAME}}s");
    }
}

// ============================================================
// HOW TO CREATE A MIGRATION
// ============================================================
//
// 1. Add your entity to AppDbContext:
//
//    public DbSet<{{pascalCase FEATURE_NAME}}> {{pascalCase FEATURE_NAME}}s => Set<{{pascalCase FEATURE_NAME}}>();
//
// 2. Add your configuration:
//
//    protected override void OnModelCreating(ModelBuilder modelBuilder)
//    {
//        modelBuilder.ApplyConfiguration(new {{pascalCase FEATURE_NAME}}Configuration());
//    }
//
// 3. Run migration command:
//
//    dotnet ef migrations add Add{{pascalCase FEATURE_NAME}} -p src/{{NAMESPACE}}.Infrastructure -s src/{{NAMESPACE}}.Web
//
// 4. Apply migration:
//
//    dotnet ef database update -p src/{{NAMESPACE}}.Infrastructure -s src/{{NAMESPACE}}.Web
//
// ============================================================
