using Microsoft.EntityFrameworkCore.Migrations;

namespace wispro.sp.api.Migrations
{
    public partial class addObjectStaffStatistics : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "StaffStatistics",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CalMonthId = table.Column<int>(type: "int", nullable: false),
                    StaffId = table.Column<int>(type: "int", nullable: false),
                    jxType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    totalBasePoint = table.Column<double>(type: "float", nullable: true),
                    totalActuallyPoint = table.Column<double>(type: "float", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StaffStatistics", x => x.Id);
                    table.ForeignKey(
                        name: "FK_StaffStatistics_CalMonth_CalMonthId",
                        column: x => x.CalMonthId,
                        principalTable: "CalMonth",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_StaffStatistics_Staff_StaffId",
                        column: x => x.StaffId,
                        principalTable: "Staff",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_StaffStatistics_CalMonthId",
                table: "StaffStatistics",
                column: "CalMonthId");

            migrationBuilder.CreateIndex(
                name: "IX_StaffStatistics_StaffId",
                table: "StaffStatistics",
                column: "StaffId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "StaffStatistics");
        }
    }
}
