DD.WellWorkover.Cloud/AsbCloudDb/Migrations/20221206053310_UpdateTable_t_process_map.cs

132 lines
4.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class UpdateTable_t_process_map : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "section",
table: "t_process_map");
migrationBuilder.RenameColumn(
name: "rotor_torque_plan",
table: "t_process_map",
newName: "top_drive_torque_plan");
migrationBuilder.RenameColumn(
name: "rotor_torque_fact",
table: "t_process_map",
newName: "top_drive_torque_fact");
migrationBuilder.RenameColumn(
name: "rotor_speed_plan",
table: "t_process_map",
newName: "top_drive_speed_plan");
migrationBuilder.RenameColumn(
name: "rotor_speed_fact",
table: "t_process_map",
newName: "top_drive_speed_fact");
migrationBuilder.RenameColumn(
name: "mechanical_speed_plan",
table: "t_process_map",
newName: "rop_plan");
migrationBuilder.AddColumn<int>(
name: "id_wellsection_type",
table: "t_process_map",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Тип секции");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_id_wellsection_type",
table: "t_process_map",
column: "id_wellsection_type");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_well_id",
table: "t_process_map",
column: "well_id");
migrationBuilder.AddForeignKey(
name: "FK_t_process_map_t_well_section_type_id_wellsection_type",
table: "t_process_map",
column: "id_wellsection_type",
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_process_map_t_well_well_id",
table: "t_process_map",
column: "well_id",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_process_map_t_well_section_type_id_wellsection_type",
table: "t_process_map");
migrationBuilder.DropForeignKey(
name: "FK_t_process_map_t_well_well_id",
table: "t_process_map");
migrationBuilder.DropIndex(
name: "IX_t_process_map_id_wellsection_type",
table: "t_process_map");
migrationBuilder.DropIndex(
name: "IX_t_process_map_well_id",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "id_wellsection_type",
table: "t_process_map");
migrationBuilder.RenameColumn(
name: "top_drive_torque_plan",
table: "t_process_map",
newName: "rotor_torque_plan");
migrationBuilder.RenameColumn(
name: "top_drive_torque_fact",
table: "t_process_map",
newName: "rotor_torque_fact");
migrationBuilder.RenameColumn(
name: "top_drive_speed_plan",
table: "t_process_map",
newName: "rotor_speed_plan");
migrationBuilder.RenameColumn(
name: "top_drive_speed_fact",
table: "t_process_map",
newName: "rotor_speed_fact");
migrationBuilder.RenameColumn(
name: "rop_plan",
table: "t_process_map",
newName: "mechanical_speed_plan");
migrationBuilder.AddColumn<int>(
name: "section",
table: "t_process_map",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Секция");
}
}
}