using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MilitaryTrainingManagement.Migrations
{
    /// <inheritdoc />
    public partial class UpdatePersonnelFieldsComplete : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_Personnel_IdNumber",
                table: "Personnel");

            migrationBuilder.AlterColumn<string>(
                name: "IdNumber",
                table: "Personnel",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(18)",
                oldMaxLength: 18);

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

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

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

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

            migrationBuilder.AddColumn<string>(
                name: "Specialty",
                table: "Personnel",
                type: "nvarchar(max)",
                nullable: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "BirthDate",
                table: "Personnel");

            migrationBuilder.DropColumn(
                name: "EnlistmentDate",
                table: "Personnel");

            migrationBuilder.DropColumn(
                name: "Ethnicity",
                table: "Personnel");

            migrationBuilder.DropColumn(
                name: "PoliticalStatus",
                table: "Personnel");

            migrationBuilder.DropColumn(
                name: "Specialty",
                table: "Personnel");

            migrationBuilder.AlterColumn<string>(
                name: "IdNumber",
                table: "Personnel",
                type: "nvarchar(18)",
                maxLength: 18,
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Personnel_IdNumber",
                table: "Personnel",
                column: "IdNumber",
                unique: true);
        }
    }
}
