using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MTWorkHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class altrOrderRequestService : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<decimal>(
                name: "CourseCost",
                table: "OrderRequests",
                type: "decimal(18,2)",
                nullable: true);

            migrationBuilder.AddColumn<decimal>(
                name: "CourseNumberOfHours",
                table: "OrderRequests",
                type: "decimal(18,2)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "RequestTitle",
                table: "OrderRequests",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "ServiceCertificateId",
                table: "OrderRequests",
                type: "bigint",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "ServiceCertificate",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ToWhom = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Salary = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    JoiningDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ToDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Position = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ServiceCertificate", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_OrderRequests_ServiceCertificateId",
                table: "OrderRequests",
                column: "ServiceCertificateId");

            migrationBuilder.AddForeignKey(
                name: "FK_OrderRequests_ServiceCertificate_ServiceCertificateId",
                table: "OrderRequests",
                column: "ServiceCertificateId",
                principalTable: "ServiceCertificate",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_OrderRequests_ServiceCertificate_ServiceCertificateId",
                table: "OrderRequests");

            migrationBuilder.DropTable(
                name: "ServiceCertificate");

            migrationBuilder.DropIndex(
                name: "IX_OrderRequests_ServiceCertificateId",
                table: "OrderRequests");

            migrationBuilder.DropColumn(
                name: "CourseCost",
                table: "OrderRequests");

            migrationBuilder.DropColumn(
                name: "CourseNumberOfHours",
                table: "OrderRequests");

            migrationBuilder.DropColumn(
                name: "RequestTitle",
                table: "OrderRequests");

            migrationBuilder.DropColumn(
                name: "ServiceCertificateId",
                table: "OrderRequests");
        }
    }
}
