forked from ddrilling/AsbCloudServer
94 lines
5.4 KiB
C#
94 lines
5.4 KiB
C#
|
using System;
|
|||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace AsbCloudDb.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class Add_ProcessMapPlanSubsystems : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "t_process_map_plan_subsystems",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
auto_rotor = table.Column<double>(type: "double precision", nullable: false, comment: "Процент использования ротора"),
|
|||
|
auto_slide = table.Column<double>(type: "double precision", nullable: false, comment: "Процент использования слайда"),
|
|||
|
auto_oscillation = table.Column<double>(type: "double precision", nullable: false, comment: "Процент использования слайда с осцилляцией"),
|
|||
|
note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true, 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_subsystems", x => x.id);
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_t_process_map_plan_subsystems_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_subsystems_t_user_id_editor",
|
|||
|
column: x => x.id_editor,
|
|||
|
principalTable: "t_user",
|
|||
|
principalColumn: "id");
|
|||
|
table.ForeignKey(
|
|||
|
name: "FK_t_process_map_plan_subsystems_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_subsystems_t_well_section_type_id_wellse~",
|
|||
|
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_subsystems_id_author",
|
|||
|
table: "t_process_map_plan_subsystems",
|
|||
|
column: "id_author");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_process_map_plan_subsystems_id_editor",
|
|||
|
table: "t_process_map_plan_subsystems",
|
|||
|
column: "id_editor");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_process_map_plan_subsystems_id_well",
|
|||
|
table: "t_process_map_plan_subsystems",
|
|||
|
column: "id_well");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_process_map_plan_subsystems_id_wellsection_type",
|
|||
|
table: "t_process_map_plan_subsystems",
|
|||
|
column: "id_wellsection_type");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "t_process_map_plan_subsystems");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|