using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace WorkFlowCheck.DL.Migrations
{
    /// <inheritdoc />
    public partial class Extend009 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "CheckStatus",
                table: "CheckListHeader",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "RoleCheckPoint",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    CheckPointId = table.Column<int>(type: "int", nullable: false),
                    Enabled = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleCheckPoint", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RoleCheckPoint_CheckPoint_CheckPointId",
                        column: x => x.CheckPointId,
                        principalTable: "CheckPoint",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_RoleCheckPoint_Roles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "Roles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 31, 9, 37, 40, 826, DateTimeKind.Utc).AddTicks(2914), new DateTime(2025, 3, 31, 9, 37, 40, 826, DateTimeKind.Utc).AddTicks(2918) });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 31, 9, 37, 40, 838, DateTimeKind.Utc).AddTicks(1281), new DateTime(2025, 3, 31, 9, 37, 40, 838, DateTimeKind.Utc).AddTicks(1285) });

            migrationBuilder.CreateIndex(
                name: "IX_RoleCheckPoint_CheckPointId",
                table: "RoleCheckPoint",
                column: "CheckPointId");

            migrationBuilder.CreateIndex(
                name: "IX_RoleCheckPoint_RoleId",
                table: "RoleCheckPoint",
                column: "RoleId");
        }

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

            migrationBuilder.DropColumn(
                name: "CheckStatus",
                table: "CheckListHeader");

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8912), new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8916) });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9869), new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9870) });
        }
    }
}
