using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace UniVerse.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class LevelThresholds : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "level_thresholds",
                columns: table => new
                {
                    level = table.Column<int>(type: "integer", nullable: false),
                    required_xp = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_level_thresholds", x => x.level);
                    table.CheckConstraint("CK_level_thresholds_level_positive", "level > 0");
                    table.CheckConstraint("CK_level_thresholds_required_xp_non_negative", "required_xp >= 0");
                });

            migrationBuilder.InsertData(
                table: "level_thresholds",
                columns: new[] { "level", "required_xp" },
                values: new object[,]
                {
                    { 1, 0 },
                    { 2, 100 },
                    { 3, 300 },
                    { 4, 600 },
                    { 5, 1000 },
                    { 6, 1500 },
                    { 7, 2500 },
                    { 8, 4000 }
                });

            migrationBuilder.CreateIndex(
                name: "IX_level_thresholds_required_xp",
                table: "level_thresholds",
                column: "required_xp",
                unique: true);
        }

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