using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AsbCloudDb.Migrations
{
    public partial class WellOperationCategory_editDBmodel : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "code",
                table: "t_well_operation_category");

            migrationBuilder.AddColumn<int>(
                name: "id_parent",
                table: "t_well_operation_category",
                type: "integer",
                nullable: true,
                comment: "id родительской категории");

            migrationBuilder.CreateIndex(
                name: "IX_t_well_operation_category_id_parent",
                table: "t_well_operation_category",
                column: "id_parent");

            migrationBuilder.AddForeignKey(
                name: "FK_t_well_operation_category_t_well_operation_category_id_pare~",
                table: "t_well_operation_category",
                column: "id_parent",
                principalTable: "t_well_operation_category",
                principalColumn: "id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_t_well_operation_category_t_well_operation_category_id_pare~",
                table: "t_well_operation_category");

            migrationBuilder.DropIndex(
                name: "IX_t_well_operation_category_id_parent",
                table: "t_well_operation_category");

            migrationBuilder.DropColumn(
                name: "id_parent",
                table: "t_well_operation_category");

            migrationBuilder.AddColumn<int>(
                name: "code",
                table: "t_well_operation_category",
                type: "integer",
                nullable: false,
                defaultValue: 0,
                comment: "Код операции");
        }
    }
}