using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace esuite.Database.SqlServer.Migrations
{
    /// <inheritdoc />
    public partial class AddCustomFieldNumbers : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CustomFieldNumbers",
                schema: "CustomFields",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CustomFieldId = table.Column<long>(type: "bigint", nullable: false),
                    MinimumValue = table.Column<decimal>(type: "decimal(28,8)", precision: 28, scale: 8, nullable: true),
                    MaximumValue = table.Column<decimal>(type: "decimal(28,8)", precision: 28, scale: 8, nullable: true),
                    Step = table.Column<decimal>(type: "decimal(28,8)", precision: 28, scale: 8, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomFieldNumbers", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CustomFieldNumbers_CustomFields_CustomFieldId",
                        column: x => x.CustomFieldId,
                        principalSchema: "CustomFields",
                        principalTable: "CustomFields",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_CustomFieldNumbers_CustomFieldId",
                schema: "CustomFields",
                table: "CustomFieldNumbers",
                column: "CustomFieldId");
        }

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