using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AsbCloudDb.Migrations
{
    public partial class Add_Well_To_Contacts : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "id_well",
                table: "t_contact",
                type: "integer",
                maxLength: 255,
                nullable: false,
                defaultValue: 0,
                comment: "ключ скважины");

            migrationBuilder.CreateIndex(
                name: "IX_t_contact_id_well",
                table: "t_contact",
                column: "id_well");

            migrationBuilder.AddForeignKey(
                name: "FK_t_contact_t_well_id_well",
                table: "t_contact",
                column: "id_well",
                principalTable: "t_well",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_t_contact_t_well_id_well",
                table: "t_contact");

            migrationBuilder.DropIndex(
                name: "IX_t_contact_id_well",
                table: "t_contact");

            migrationBuilder.DropColumn(
                name: "id_well",
                table: "t_contact");
        }
    }
}