forked from ddrilling/AsbCloudServer
96 lines
5.9 KiB
C#
96 lines
5.9 KiB
C#
using System;
|
||
using Microsoft.EntityFrameworkCore.Migrations;
|
||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||
|
||
#nullable disable
|
||
|
||
namespace AsbCloudDb.Migrations
|
||
{
|
||
public partial class Add_ProcessMapPlanReams : Migration
|
||
{
|
||
protected override void Up(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.CreateTable(
|
||
name: "t_process_map_plan_ream",
|
||
columns: table => new
|
||
{
|
||
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
repeats = table.Column<double>(type: "double precision", nullable: false, comment: "Количество повторений"),
|
||
spin_upward = table.Column<double>(type: "double precision", nullable: false, comment: "Вращение при движении вверх, об/мин"),
|
||
spin_downward = table.Column<double>(type: "double precision", nullable: false, comment: "Вращение при движении вниз, об/мин"),
|
||
speed_upward = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость подъёма, м/ч"),
|
||
speed_downward = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость спуска, м/ч"),
|
||
setpoint_drag = table.Column<double>(type: "double precision", nullable: false, comment: "Уставка зятяжки, т"),
|
||
setpoint_tight = table.Column<double>(type: "double precision", nullable: false, comment: "Уставка посадки, т"),
|
||
pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Давление, атм"),
|
||
torque = table.Column<double>(type: "double precision", nullable: false, comment: "Момент, кН*м"),
|
||
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
|
||
id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
|
||
creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
|
||
obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
|
||
id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
|
||
id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
|
||
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
|
||
id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
|
||
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
|
||
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_t_process_map_plan_ream", x => x.id);
|
||
table.ForeignKey(
|
||
name: "FK_t_process_map_plan_ream_t_user_id_author",
|
||
column: x => x.id_author,
|
||
principalTable: "t_user",
|
||
principalColumn: "id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
table.ForeignKey(
|
||
name: "FK_t_process_map_plan_ream_t_user_id_editor",
|
||
column: x => x.id_editor,
|
||
principalTable: "t_user",
|
||
principalColumn: "id");
|
||
table.ForeignKey(
|
||
name: "FK_t_process_map_plan_ream_t_well_id_well",
|
||
column: x => x.id_well,
|
||
principalTable: "t_well",
|
||
principalColumn: "id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
table.ForeignKey(
|
||
name: "FK_t_process_map_plan_ream_t_well_section_type_id_wellsection_~",
|
||
column: x => x.id_wellsection_type,
|
||
principalTable: "t_well_section_type",
|
||
principalColumn: "id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
},
|
||
comment: "РТК проработка скважины");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_t_process_map_plan_ream_id_author",
|
||
table: "t_process_map_plan_ream",
|
||
column: "id_author");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_t_process_map_plan_ream_id_editor",
|
||
table: "t_process_map_plan_ream",
|
||
column: "id_editor");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_t_process_map_plan_ream_id_well",
|
||
table: "t_process_map_plan_ream",
|
||
column: "id_well");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_t_process_map_plan_ream_id_wellsection_type",
|
||
table: "t_process_map_plan_ream",
|
||
column: "id_wellsection_type");
|
||
}
|
||
|
||
protected override void Down(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.DropTable(
|
||
name: "t_process_map_plan_ream");
|
||
}
|
||
}
|
||
}
|