// ============================================================
// EF CORE MIGRATION TEMPLATE
// Generated by MORPH Framework
// ============================================================

using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MyProject.Infrastructure.Data.Migrations;

/// <inheritdoc />
public partial class Add{Feature} : Migration
{
    /// <inheritdoc />
    protected override void Up(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.CreateTable(
            name: "{Feature}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_{Feature}s", x => x.Id);
            });

        // Indexes
        migrationBuilder.CreateIndex(
            name: "IX_{Feature}s_Name",
            table: "{Feature}s",
            column: "Name");

        migrationBuilder.CreateIndex(
            name: "IX_{Feature}s_Status",
            table: "{Feature}s",
            column: "Status");

        migrationBuilder.CreateIndex(
            name: "IX_{Feature}s_CreatedAt",
            table: "{Feature}s",
            column: "CreatedAt");
    }

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

// ============================================================
// HOW TO CREATE A MIGRATION
// ============================================================
//
// 1. Add your entity to AppDbContext:
//
//    public DbSet<{Feature}> {Feature}s => Set<{Feature}>();
//
// 2. Add your configuration:
//
//    protected override void OnModelCreating(ModelBuilder modelBuilder)
//    {
//        modelBuilder.ApplyConfiguration(new {Feature}Configuration());
//    }
//
// 3. Run migration command:
//
//    dotnet ef migrations add Add{Feature} -p src/MyProject.Infrastructure -s src/MyProject.Web
//
// 4. Apply migration:
//
//    dotnet ef database update -p src/MyProject.Infrastructure -s src/MyProject.Web
//
// ============================================================
