using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace GreenTree.Strohrmann.ERP.Domain.Migrations
{
    public partial class CraftEmployee_Hotfix : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_CraftEmployees",
                table: "CraftEmployees");

            migrationBuilder.AddColumn<int>(
                name: "Id",
                table: "CraftEmployees",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<string>(
                name: "Comment",
                table: "CraftEmployees",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_CraftEmployees",
                table: "CraftEmployees",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_CraftEmployees_CraftId",
                table: "CraftEmployees",
                column: "CraftId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_CraftEmployees",
                table: "CraftEmployees");

            migrationBuilder.DropIndex(
                name: "IX_CraftEmployees_CraftId",
                table: "CraftEmployees");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "CraftEmployees");

            migrationBuilder.DropColumn(
                name: "Comment",
                table: "CraftEmployees");

            migrationBuilder.AddPrimaryKey(
                name: "PK_CraftEmployees",
                table: "CraftEmployees",
                columns: new[] { "CraftId", "EmployeeId" });
        }
    }
}
