Trim migrations history

This commit is contained in:
ngfrolov 2023-02-17 12:25:46 +05:00
parent dcc3667e6a
commit 3510af3628
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7
191 changed files with 52 additions and 419554 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,957 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{
#nullable disable
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:PostgresExtension:adminpack", ",,");
migrationBuilder.CreateTable(
name: "t_company_type",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_company_type", x => x.id);
});
migrationBuilder.CreateTable(
name: "t_deposit",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
latitude = table.Column<double>(type: "double precision", nullable: true),
longitude = table.Column<double>(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_deposit", x => x.id);
},
comment: "Месторождение");
migrationBuilder.CreateTable(
name: "t_file_category",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: true, comment: "Название категории"),
short_name = table.Column<string>(type: "text", nullable: true, comment: "Короткое название категории")
},
constraints: table =>
{
table.PrimaryKey("PK_t_file_category", x => x.id);
},
comment: "Категории файлов");
migrationBuilder.CreateTable(
name: "t_measure_category",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: true, comment: "Название категории"),
short_name = table.Column<string>(type: "text", nullable: true, comment: "Короткое название категории")
},
constraints: table =>
{
table.PrimaryKey("PK_t_measure_category", x => x.id);
},
comment: "Категория последних данных");
migrationBuilder.CreateTable(
name: "t_telemetry",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
remote_uid = table.Column<string>(type: "text", nullable: true, comment: "Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."),
info = table.Column<TelemetryInfo>(type: "jsonb", nullable: true, comment: "Информация с панели о скважине")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry", x => x.id);
},
comment: "таблица привязки телеметрии от комплектов к конкретной скважине.");
migrationBuilder.CreateTable(
name: "t_user_role",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_user_role", x => x.id);
},
comment: "Роли пользователей в системе");
migrationBuilder.CreateTable(
name: "t_well_operation_category",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: true, comment: "Название категории операции"),
code = table.Column<int>(type: "integer", nullable: false, comment: "Код операции")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_operation_category", x => x.id);
},
comment: "Справочник операций на скважине");
migrationBuilder.CreateTable(
name: "t_well_section_type",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_section_type", x => x.id);
},
comment: "конструкция секции скважины");
migrationBuilder.CreateTable(
name: "t_well_type",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_type", x => x.id);
},
comment: "конструкция скважины");
migrationBuilder.CreateTable(
name: "t_company",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
id_company_type = table.Column<int>(type: "integer", maxLength: 255, nullable: false, comment: "вид деятельности")
},
constraints: table =>
{
table.PrimaryKey("PK_t_company", x => x.id);
table.ForeignKey(
name: "FK_t_company_t_company_type_id_company_type",
column: x => x.id_company_type,
principalTable: "t_company_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "t_cluster",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название"),
id_deposit = table.Column<int>(type: "integer", nullable: true),
latitude = table.Column<double>(type: "double precision", nullable: true),
longitude = table.Column<double>(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_cluster", x => x.id);
table.ForeignKey(
name: "t_cluster_t_deposit_id_fk",
column: x => x.id_deposit,
principalTable: "t_deposit",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "Кусты");
migrationBuilder.CreateTable(
name: "t_data_saub_base",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "'2021-10-19 18:23:54+05'"),
mode = table.Column<int>(type: "integer", nullable: true, comment: "Режим САУБ"),
id_user = table.Column<int>(type: "integer", nullable: true, comment: "Пользователь САУБ"),
well_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина забоя"),
bit_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Положение инструмента"),
block_position = table.Column<double>(type: "double precision", nullable: true, comment: "Высота талевого блока"),
block_position_min = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Мин положение"),
block_position_max = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Макс положение"),
block_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Скорость талевого блока"),
block_speed_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Скорости талевого блока. Задание"),
block_speed_sp_rotor = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для роторного бурения"),
block_speed_sp_slide = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для режима слайда"),
block_speed_sp_develop = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для проработки"),
pressure = table.Column<double>(type: "double precision", nullable: true, comment: "Давление"),
pressure_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Холостой ход"),
pressure_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание"),
pressure_sp_rotor = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание для роторного бурения"),
pressure_sp_slide = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание для режима слайда"),
pressure_sp_develop = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание для проработки"),
pressure_delta_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Давление дифф. Аварийное макс."),
axial_load = table.Column<double>(type: "double precision", nullable: true, comment: "Осевая нагрузка"),
axial_load_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Осевая нагрузка. Задание"),
axial_load_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Осевая нагрузка. Аварийная макс."),
hook_weight = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке"),
hook_weight_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке. Холостой ход"),
hook_weight_limit_min = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке. Посадка"),
hook_weight_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке. Затяжка"),
rotor_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе"),
rotor_torque_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе. Холостой ход"),
rotor_torque_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе. Задание"),
rotor_torque_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе. Аварийный макс."),
rotor_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Обороты ротора"),
flow = table.Column<double>(type: "double precision", nullable: true, comment: "Расход"),
flow_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Расход. Холостой ход"),
flow_delta_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Расход. Аварийный макс."),
id_feed_regulator = table.Column<double>(type: "double precision", nullable: true, comment: "Текущий критерий бурения"),
mse_state = table.Column<double>(type: "double precision", nullable: true, comment: "Текущее состояние работы MSE")
},
constraints: table =>
{
table.PrimaryKey("PK_t_data_saub_base", x => x.id);
table.ForeignKey(
name: "t_data_saub_base_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "набор основных данных по SAUB");
migrationBuilder.CreateTable(
name: "t_telemetry_event",
columns: table => new
{
id_event = table.Column<int>(type: "integer", nullable: false),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_category = table.Column<int>(type: "integer", nullable: false),
message_template = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_event", x => new { x.id_telemetry, x.id_event });
table.ForeignKey(
name: "t_event_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
migrationBuilder.CreateTable(
name: "t_telemetry_message",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_event = table.Column<int>(type: "integer", nullable: false),
id_telemetry_user = table.Column<int>(type: "integer", nullable: true, comment: "Пользователь панели отправляющей телеметрию. не пользователь облака."),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
arg0 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Аргумент №0 для вставки в шаблон сообщения"),
arg1 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
arg2 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
arg3 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_message", x => x.id);
table.ForeignKey(
name: "t_messages_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Сообщения на буровых");
migrationBuilder.CreateTable(
name: "t_telemetry_user",
columns: table => new
{
id_user = table.Column<int>(type: "integer", nullable: false),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
surname = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
patronymic = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
level = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_user", x => new { x.id_telemetry, x.id_user });
table.ForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "Пользователи панели САУБ. Для сообщений.");
migrationBuilder.CreateTable(
name: "t_telemetry_analysis",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_operation = table.Column<int>(type: "integer", nullable: false),
unix_date = table.Column<long>(type: "bigint", nullable: false, comment: "Unix timestamp для Linq запросов с вычислением дат"),
duration_sec = table.Column<int>(type: "integer", nullable: false, comment: "Кол-во секунд после предыдущей операции"),
operation_start_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина, на которой началась операция"),
operation_end_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина, на которой закончилась операция"),
is_well_depth_increasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Глубина забоя увеличивается"),
is_well_depth_decreasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Глубина забоя не увеличивается"),
is_bit_position_increasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Долото спускается"),
is_bit_position_decreasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Долото поднимается"),
is_bit_posision_lt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Положение долота меньше 20м"),
is_block_posision_incresing = table.Column<bool>(type: "boolean", nullable: false, comment: "Талевый блок спускается"),
is_block_posision_decresing = table.Column<bool>(type: "boolean", nullable: false, comment: "Талевый блок поднимается"),
is_rotor_speed_lt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Обороты ротора ниже 3"),
is_rotor_speed_gt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Обороты ротора выше 3"),
is_pressure_lt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Давление менее 20"),
is_pressure_gt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Давоение более 20"),
is_hook_weight_not_changes = table.Column<bool>(type: "boolean", nullable: false, comment: "Вес на крюке не меняется"),
is_hook_weight_lt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Вес на крюке менее 3т")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_analysis", x => x.id);
table.ForeignKey(
name: "t_analysis_t_operation_id_fk",
column: x => x.id_operation,
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "t_analysis_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "События на скважине");
migrationBuilder.CreateTable(
name: "t_user",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_company = table.Column<int>(type: "integer", nullable: true),
id_role = table.Column<int>(type: "integer", nullable: true),
login = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
password_hash = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "соленый хэш пароля.\nпервые 5 символов - соль"),
state = table.Column<short>(type: "smallint", nullable: true, comment: "состояние:\n100 - удален"),
level = table.Column<int>(type: "integer", nullable: true),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "имя"),
surname = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "фамилия"),
patronymic = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "отчество")
},
constraints: table =>
{
table.PrimaryKey("PK_t_user", x => x.id);
table.ForeignKey(
name: "FK_t_user_t_user_role_id_role",
column: x => x.id_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "t_user_t_company_id_fk",
column: x => x.id_company,
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "Пользователи облака");
migrationBuilder.CreateTable(
name: "t_well",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
id_cluster = table.Column<int>(type: "integer", nullable: true),
id_telemetry = table.Column<int>(type: "integer", nullable: true),
id_well_type = table.Column<int>(type: "integer", nullable: true),
latitude = table.Column<double>(type: "double precision", nullable: true),
longitude = table.Column<double>(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_well", x => x.id);
table.ForeignKey(
name: "FK_t_well_t_well_type_id_well_type",
column: x => x.id_well_type,
principalTable: "t_well_type",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "t_well_t_cluster_id_fk",
column: x => x.id_cluster,
principalTable: "t_cluster",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "t_well_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "скважины");
migrationBuilder.CreateTable(
name: "t_file_info",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_author = table.Column<int>(type: "integer", nullable: true, comment: "Id пользователя, загрузившего файл"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "id категории файла"),
name = table.Column<string>(type: "text", nullable: true, comment: "Название файла"),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
file_size = table.Column<long>(type: "bigint", nullable: false, comment: "Размер файла"),
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Удален ли файл")
},
constraints: table =>
{
table.PrimaryKey("PK_t_file_info", x => x.id);
table.ForeignKey(
name: "FK_t_file_info_t_file_category_id_category",
column: x => x.id_category,
principalTable: "t_file_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_file_info_t_user_id_author",
column: x => x.id_author,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_t_file_info_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Файлы всех категорий");
migrationBuilder.CreateTable(
name: "t_measure",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "id категории"),
timestamp = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "время добавления"),
data = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true, comment: "Данные таблицы последних данных"),
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Пометка удаленным")
},
constraints: table =>
{
table.PrimaryKey("PK_t_measure", x => x.id);
table.ForeignKey(
name: "FK_t_measure_t_measure_category_id_category",
column: x => x.id_category,
principalTable: "t_measure_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_measure_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица c данными для вкладки 'Последние данные'");
migrationBuilder.CreateTable(
name: "t_relation_company_well",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false),
id_company = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_company_well", x => new { x.id_company, x.id_well });
table.ForeignKey(
name: "t_relation_company_well_t_company_id_fk",
column: x => x.id_company,
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_relation_company_well_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "отношение скважин и компаний");
migrationBuilder.CreateTable(
name: "t_well_operation",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции скважины"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "Id категории операции"),
id_type = table.Column<int>(type: "integer", nullable: false, comment: "0 = План или 1 = Факт"),
depth = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина, на которой производилась операция"),
date = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "Дата начала операции"),
duration_hours = table.Column<double>(type: "double precision", nullable: false, comment: "Продолжительность в часах"),
category_info = table.Column<string>(type: "text", nullable: true, comment: "Доп. информация к выбраной категории"),
comment = table.Column<string>(type: "text", nullable: true, comment: "Комментарий")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_operation", x => x.id);
table.ForeignKey(
name: "FK_t_well_operation_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_well_operation_t_well_operation_category_id_category",
column: x => x.id_category,
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_well_operation_t_well_section_type_id_well_section_type",
column: x => x.id_well_section_type,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Данные по операциям на скважине");
migrationBuilder.CreateTable(
name: "t_report_property",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_file = table.Column<int>(type: "integer", nullable: false, comment: "id файла-родителя"),
begin = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
end = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "timestamp with time zone"),
step = table.Column<int>(type: "integer", nullable: false, comment: "размер шага в секундах"),
format = table.Column<int>(type: "integer", nullable: false, comment: "Формат отчета")
},
constraints: table =>
{
table.PrimaryKey("PK_t_report_property", x => x.id);
table.ForeignKey(
name: "FK_t_report_property_t_file_info_id_file",
column: x => x.id_file,
principalTable: "t_file_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_report_property_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отчеты с данными по буровым");
migrationBuilder.InsertData(
table: "t_company_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Недрапользователь" },
{ 2, "Буровой подрядчик" },
{ 3, "Сервис автоматизации бурения" }
});
migrationBuilder.InsertData(
table: "t_file_category",
columns: new[] { "id", "name", "short_name" },
values: new object[,]
{
{ 13, "Программа бурения, части", "ПБч" },
{ 12, "Рапорт", "report" },
{ 11, "Последние данные ННБ", "nnbLastData" },
{ 10, "Последние данные Шламограммы", "mudLastData" },
{ 9, "Последний замер бурового раствора ФАКТ", "fluidFactLastData" },
{ 8, "Последний замер бурового раствора ПЛАН", "fluidPlanLastData" },
{ 6, "Супервайзер", "supervisor" },
{ 14, "Программа бурения", "ПБ" },
{ 5, "Документы по скважине", "wellDocuments" },
{ 4, "ГТИ", "gti" },
{ 3, "ННБ", "nnb" },
{ 2, "Цементирование", "cement" },
{ 1, "Растворный сервис", "fluidService" },
{ 7, "Мастер", "master" }
});
migrationBuilder.InsertData(
table: "t_measure_category",
columns: new[] { "id", "name", "short_name" },
values: new object[,]
{
{ 3, "ННБ", "ННБ" },
{ 2, "Шламограмма", "Шламограмма" },
{ 1, "Показатели бурового раствора", "Раствор" }
});
migrationBuilder.InsertData(
table: "t_user_role",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Администратор" },
{ 2, "Пользователь" }
});
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[,]
{
{ 1031, 0, "Ремонт" },
{ 1030, 0, "Разбуривание тех.оснастки" },
{ 1029, 0, "Прокачка пачек" },
{ 1028, 0, "Промежуточная промывка" },
{ 1027, 0, "Промывка" },
{ 1026, 0, "Разборка КНБК" },
{ 1024, 0, "Подготовительные работы" },
{ 1032, 0, "Спуск инструмента" },
{ 1023, 0, "Сборка инструмента" },
{ 1022, 0, "Обратная проработка" },
{ 1021, 0, "Подъем инструмента с промывкой" },
{ 1020, 0, "Подъем инструмента" },
{ 1019, 0, "Перетяжка тальканата" },
{ 1025, 0, "Сборка КНБК" },
{ 1033, 0, "Спуск инструмента с промывкой" },
{ 1044, 0, "ВМР" },
{ 1035, 0, "Принудительная проработка" },
{ 1036, 0, "Спуск обсадной колонны" },
{ 1037, 0, "Тех СПО-подъем" },
{ 1038, 0, "Тех СПО-спуск" },
{ 1039, 0, "Техническое обслуживание" },
{ 1040, 0, "Цементаж" },
{ 1041, 0, "Шаблонировка ствола" },
{ 1042, 0, "Геологическое осложнение" },
{ 1043, 0, "НПВ" },
{ 1018, 0, "Перетяжка талевого каната" },
{ 1045, 0, "Прочее" },
{ 1046, 0, "Спуск КНБК" },
{ 1047, 0, "Подъем КНБК" },
{ 1048, 0, "Спуск ОК" },
{ 1034, 0, "Прямая проработка" },
{ 1017, 0, "Перезапись каротажа" },
{ 1009, 0, "Оборудование устья" },
{ 1015, 0, "Опрессовка ВЗД" },
{ 1, 0, "Невозможно определить операцию" },
{ 2, 0, "Роторное бурение" },
{ 3, 0, "Слайдирование" },
{ 4, 0, "Подъем с проработкой" },
{ 5, 0, "Спуск с проработкой" },
{ 6, 0, "Подъем с промывкой" },
{ 7, 0, "Спуск с промывкой" },
{ 8, 0, "Спуск в скважину" },
{ 9, 0, "Спуск с вращением" },
{ 10, 0, "Подъем из скважины" },
{ 11, 0, "Подъем с вращением" },
{ 12, 0, "Промывка в покое" },
{ 1016, 0, "Перевод скв на другой тип промывочной жидкости" },
{ 14, 0, "Удержание в клиньях" },
{ 15, 0, "Неподвижное состояние" },
{ 13, 0, "Промывка с вращением" },
{ 17, 0, "На поверхности" },
{ 1014, 0, "Опресовка Ц.К." },
{ 1013, 0, "Опрессовка ПВО" },
{ 1012, 0, "Окончание цикла строительства скважины" },
{ 16, 0, "Вращение без циркуляции" },
{ 1010, 0, "ОЗЦ" },
{ 1008, 0, "ОЗЦ" },
{ 1011, 0, "Начало цикла строительства скважины" },
{ 1006, 0, "Установка ФА" },
{ 1005, 0, "Демонтаж ПВО" },
{ 1004, 0, "Монтаж ПВО" },
{ 1003, 0, "ГФР" },
{ 1002, 0, "ГИС" },
{ 1001, 0, "Бурение в интервале" },
{ 1007, 0, "Оборудование устья" }
});
migrationBuilder.InsertData(
table: "t_well_section_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Пилотный ствол" },
{ 2, "Направление" },
{ 3, "Кондуктор" },
{ 4, "Эксплуатационная колонна" },
{ 5, "Транспортный ствол" },
{ 6, "Хвостовик" }
});
migrationBuilder.InsertData(
table: "t_well_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Наклонно-направленная" },
{ 2, "Горизонтальная" }
});
migrationBuilder.InsertData(
table: "t_company",
columns: new[] { "id", "caption", "id_company_type" },
values: new object[] { 1, "ООО \"АСБ\"", 3 });
migrationBuilder.InsertData(
table: "t_user",
columns: new[] { "id", "id_company", "id_role", "level", "login", "name", "password_hash", "patronymic", "state", "surname" },
values: new object[] { 1, 1, 1, 2147483647, "dev", "Разработчик", "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072", null, null, null });
migrationBuilder.CreateIndex(
name: "IX_t_cluster_id_deposit",
table: "t_cluster",
column: "id_deposit");
migrationBuilder.CreateIndex(
name: "IX_t_company_id_company_type",
table: "t_company",
column: "id_company_type");
migrationBuilder.CreateIndex(
name: "IX_t_data_saub_base_id_telemetry",
table: "t_data_saub_base",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_file_info_id_author",
table: "t_file_info",
column: "id_author");
migrationBuilder.CreateIndex(
name: "IX_t_file_info_id_category",
table: "t_file_info",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_file_info_id_well",
table: "t_file_info",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_measure_id_category",
table: "t_measure",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_measure_id_well",
table: "t_measure",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_relation_company_well_id_well",
table: "t_relation_company_well",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_report_property_id_file",
table: "t_report_property",
column: "id_file");
migrationBuilder.CreateIndex(
name: "IX_t_report_property_id_well",
table: "t_report_property",
column: "id_well");
migrationBuilder.CreateIndex(
name: "t_telemetry_remote_uid_index",
table: "t_telemetry",
column: "remote_uid");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_analysis_id_operation",
table: "t_telemetry_analysis",
column: "id_operation");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_analysis_id_telemetry",
table: "t_telemetry_analysis",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_message_id_telemetry",
table: "t_telemetry_message",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_user_id_company",
table: "t_user",
column: "id_company");
migrationBuilder.CreateIndex(
name: "IX_t_user_id_role",
table: "t_user",
column: "id_role");
migrationBuilder.CreateIndex(
name: "IX_t_user_login",
table: "t_user",
column: "login",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_t_well_id_cluster",
table: "t_well",
column: "id_cluster");
migrationBuilder.CreateIndex(
name: "IX_t_well_id_telemetry",
table: "t_well",
column: "id_telemetry",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_t_well_id_well_type",
table: "t_well",
column: "id_well_type");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_date",
table: "t_well_operation",
column: "date");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_depth",
table: "t_well_operation",
column: "depth");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_id_category",
table: "t_well_operation",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_id_well",
table: "t_well_operation",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_id_well_section_type",
table: "t_well_operation",
column: "id_well_section_type");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_data_saub_base");
migrationBuilder.DropTable(
name: "t_measure");
migrationBuilder.DropTable(
name: "t_relation_company_well");
migrationBuilder.DropTable(
name: "t_report_property");
migrationBuilder.DropTable(
name: "t_telemetry_analysis");
migrationBuilder.DropTable(
name: "t_telemetry_event");
migrationBuilder.DropTable(
name: "t_telemetry_message");
migrationBuilder.DropTable(
name: "t_telemetry_user");
migrationBuilder.DropTable(
name: "t_well_operation");
migrationBuilder.DropTable(
name: "t_measure_category");
migrationBuilder.DropTable(
name: "t_file_info");
migrationBuilder.DropTable(
name: "t_well_operation_category");
migrationBuilder.DropTable(
name: "t_well_section_type");
migrationBuilder.DropTable(
name: "t_file_category");
migrationBuilder.DropTable(
name: "t_user");
migrationBuilder.DropTable(
name: "t_well");
migrationBuilder.DropTable(
name: "t_user_role");
migrationBuilder.DropTable(
name: "t_company");
migrationBuilder.DropTable(
name: "t_well_type");
migrationBuilder.DropTable(
name: "t_cluster");
migrationBuilder.DropTable(
name: "t_telemetry");
migrationBuilder.DropTable(
name: "t_company_type");
migrationBuilder.DropTable(
name: "t_deposit");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddUserColumns : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "email",
table: "t_user",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "должность");
migrationBuilder.AddColumn<string>(
name: "phone",
table: "t_user",
type: "character varying(50)",
maxLength: 50,
nullable: true,
comment: "номер телефона");
migrationBuilder.AddColumn<string>(
name: "position",
table: "t_user",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "email");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "email",
table: "t_user");
migrationBuilder.DropColumn(
name: "phone",
table: "t_user");
migrationBuilder.DropColumn(
name: "position",
table: "t_user");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddDefaultData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1019);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 1050, 0, "Промывка при спуске ОК" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1050);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 1019, 0, "Перетяжка тальканата" });
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{
public partial class RefactorTelemetryData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "t_data_saub_base_t_telemetry_id_fk", table: "t_data_saub_base");
migrationBuilder.DropPrimaryKey(name: "PK_t_data_saub_base", table: "t_data_saub_base");
migrationBuilder.RenameTable(name: "t_data_saub_base", newName: "t_telemetry_data_saub");
migrationBuilder.RenameIndex(name: "IX_t_data_saub_base_id_telemetry", newName: "IX_t_telemetry_data_saub_id_telemetry");
migrationBuilder.AddPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_telemetry_data_saub", column: "id");
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.CreateTable(
name: "t_telemetry_data_spin",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "'2021-10-19 18:23:54+05'"),
top_drive_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Скорость СВП"),
top_drive_speed_min = table.Column<double>(type: "double precision", nullable: true, comment: "нижний предел"),
top_drive_speed_max = table.Column<double>(type: "double precision", nullable: true, comment: "верхний предел"),
top_drive_speed_offset = table.Column<double>(type: "double precision", nullable: true, comment: "смещение"),
top_drive_speed_err = table.Column<int>(type: "integer", nullable: true),
top_drive_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Момент СВП"),
top_drive_torque_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_err = table.Column<int>(type: "integer", nullable: true),
top_drive_speed_sp_from = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость c СВП"),
top_drive_speed_sp_from_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_from_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_from_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_from_err = table.Column<int>(type: "integer", nullable: true),
top_drive_torque_sp_from = table.Column<double>(type: "double precision", nullable: true, comment: "Заданный момент c СВП"),
top_drive_torque_sp_from_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_from_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_from_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_from_err = table.Column<int>(type: "integer", nullable: true),
top_drive_speed_sp_to = table.Column<double>(type: "double precision", nullable: true, comment: "Задание скорости на СВП"),
top_drive_speed_sp_to_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_to_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_to_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_to_err = table.Column<int>(type: "integer", nullable: true),
top_drive_torque_sp_to = table.Column<double>(type: "double precision", nullable: true, comment: "Задание момента на СВП"),
top_drive_torque_sp_to_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_to_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_to_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_to_err = table.Column<int>(type: "integer", nullable: true),
w2800 = table.Column<int>(type: "integer", nullable: true, comment: "Установка нуля энкодера"),
w2810 = table.Column<int>(type: "integer", nullable: true, comment: " автоматический сброс блокировки"),
mode = table.Column<int>(type: "integer", nullable: true, comment: "Выбранный режим управления"),
w2808 = table.Column<int>(type: "integer", nullable: true, comment: "Неисправность энкодера"),
torque_starting = table.Column<double>(type: "double precision", nullable: true, comment: " Страгивающий момент"),
rotor_torque_avg = table.Column<double>(type: "double precision", nullable: true, comment: " Момент в роторе средний"),
encoder_resolution = table.Column<double>(name: "encoder_resolution ", type: "double precision", nullable: true, comment: " Разрешение энкодера"),
ratio = table.Column<double>(type: "double precision", nullable: true, comment: " Коэффициент редукции редектора"),
torque_right_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение крутящего момента вправо"),
torque_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение крутящего момента влево"),
revols_right_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение числа оборотов вправо"),
revols_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение числа оборотов влево"),
speed_right_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость вращения вправо"),
speed_left_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость вращения влево"),
revols_right_total = table.Column<double>(type: "double precision", nullable: true, comment: "Суммарное количество оборотов вправо"),
revols_left_total = table.Column<double>(type: "double precision", nullable: true, comment: "Суммарное количество оборотов влево"),
turn_right_once_by_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по моменту единожды вправо"),
turn_left_once_by_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по моменту единожды влево"),
turn_right_once_by_angle = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по градусам единожды вправо"),
turn_left_once_by_angle = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по градусам единожды влево"),
turn_right_once_by_revols = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по оборотам единожды вправо"),
turn_left_once_by_revols = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по оборотам единожды влево"),
break_angle_k = table.Column<double>(type: "double precision", nullable: true, comment: "Коэффициент для расчёта за какой угол нужно тормозить"),
reverse_k_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону"),
position_zero = table.Column<double>(type: "double precision", nullable: true, comment: "Нулевая позиция осциляции"),
position_right = table.Column<double>(type: "double precision", nullable: true, comment: "Крайний правый угол осциляции"),
torque_ramp_time = table.Column<double>(type: "double precision", nullable: true, comment: "Время нарастания момента"),
ver = table.Column<double>(type: "double precision", nullable: true, comment: "Версия ПО ПЛК"),
reverse_speed_sp_zero_time = table.Column<int>(type: "integer", nullable: true, comment: "Время выдачи сигнала нулевой скорости на при смене направления"),
unlock_by_sector_out = table.Column<double>(type: "double precision", nullable: true, comment: " Градус отклонения от сектора для автоматического сброса блокировки"),
pid_mux_torque_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: " Момент при котором определяется ехать назад по моменту или по скорости"),
state = table.Column<int>(type: "integer", nullable: true, comment: "Переменная этапа"),
break_angle_left = table.Column<double>(type: "double precision", nullable: true, comment: "Угол торможения влево при работе по моменту")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_data_spin", x => x.id);
table.ForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "набор основных данных по SpinMaster");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_data_spin_id_telemetry",
table: "t_telemetry_data_spin",
column: "id_telemetry");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_telemetry_data_spin");
migrationBuilder.DropForeignKey(name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub");
migrationBuilder.DropPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_telemetry_data_saub");
migrationBuilder.RenameTable(name: "t_telemetry_data_saub", newName: "t_data_saub_base");
migrationBuilder.RenameIndex(name: "IX_t_telemetry_data_saub_id_telemetry", newName: "IX_t_data_saub_base_id_telemetry");
migrationBuilder.AddPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_data_saub_base", column: "id");
migrationBuilder.AddForeignKey(
name: "t_data_saub_t_telemetry_id_fk",
table: "t_data_saub_base",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddWellDepthToMessage : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "well_depth",
table: "t_telemetry_message",
type: "double precision",
nullable: false,
defaultValue: 0.0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "well_depth",
table: "t_telemetry_message");
}
}
}

View File

@ -1,133 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Set_Telemetry_FKs_OnDelete_Cascade : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub");
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin");
migrationBuilder.DropForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user");
migrationBuilder.DropForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user");
migrationBuilder.DropForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well");
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user",
column: "id_company",
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub");
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin");
migrationBuilder.DropForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user");
migrationBuilder.DropForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user");
migrationBuilder.DropForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well");
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user",
column: "id_company",
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Update_WellOperationsCategory_by_new_initial_values : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 1019, 0, "Наращивание, промывка" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1019);
}
}
}

View File

@ -1,53 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_WellOperation_WellDepth_to_WellDepthEnd : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "depth",
table: "t_well_operation",
newName: "depth_end");
migrationBuilder.RenameColumn(
name: "date",
table: "t_well_operation",
newName: "date_start");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_depth",
table: "t_well_operation",
newName: "IX_t_well_operation_depth_end");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_date",
table: "t_well_operation",
newName: "IX_t_well_operation_date_start");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "depth_end",
table: "t_well_operation",
newName: "depth");
migrationBuilder.RenameColumn(
name: "date_start",
table: "t_well_operation",
newName: "date");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_depth_end",
table: "t_well_operation",
newName: "IX_t_well_operation_depth");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_date_start",
table: "t_well_operation",
newName: "IX_t_well_operation_date");
}
}
}

View File

@ -1,65 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_WellOperation_WellDepthStart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "duration_hours",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Продолжительность, часы",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Продолжительность в часах");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина, на которой производилась операция");
migrationBuilder.AddColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Глубина забоя на начало операции, м");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "depth_start",
table: "t_well_operation");
migrationBuilder.AlterColumn<double>(
name: "duration_hours",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Продолжительность в часах",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Продолжительность, часы");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина, на которой производилась операция",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя после завершения операции, м");
}
}
}

View File

@ -1,111 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Rename_DrillingParam_Consumption_to_Flow : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина на начало операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя на начало операции, м");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя после завершения операции, м");
migrationBuilder.CreateTable(
name: "t_drill_params",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
well_id = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Стартовая глубина"),
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина окончания интервала"),
id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Id с типом секции скважины"),
axial_load_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальная нагрузка"),
axial_load_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средняя нагрузка"),
axial_load_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальная нагрузка"),
pressure_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальное давление"),
pressure_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Среднее давление"),
pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальное давление"),
top_drive_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный момент на ВСП"),
top_drive_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средний момент на ВСП"),
top_drive_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный момент на ВСП"),
top_drive_speed_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты на ВСП"),
top_drive_speed_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средние обороты на ВСП"),
top_drive_speed_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальные обороты на ВСП"),
flow_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный расход"),
flow_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средний расход"),
flow_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный расход")
},
constraints: table =>
{
table.PrimaryKey("PK_t_drill_params", x => x.id);
table.ForeignKey(
name: "FK_t_drill_params_t_well_well_id",
column: x => x.well_id,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_drill_params_t_well_section_type_id_fk",
column: x => x.id_wellsection_type,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Режим бурения в секции (диапазоны параметров бурения)");
migrationBuilder.CreateIndex(
name: "IX_t_drill_params_id_wellsection_type",
table: "t_drill_params",
column: "id_wellsection_type");
migrationBuilder.CreateIndex(
name: "IX_t_drill_params_well_id",
table: "t_drill_params",
column: "well_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_drill_params");
migrationBuilder.AlterColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя на начало операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина на начало операции, м");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина после завершения операции, м");
}
}
}

View File

@ -1,73 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_DrillingParam_TopDrive_to_Rotor : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "top_drive_speed_min",
table: "t_drill_params",
newName: "rotor_speed_min");
migrationBuilder.RenameColumn(
name: "top_drive_speed_max",
table: "t_drill_params",
newName: "rotor_speed_max");
migrationBuilder.RenameColumn(
name: "top_drive_speed_avg",
table: "t_drill_params",
newName: "rotor_speed_avg");
migrationBuilder.RenameColumn(
name: "top_drive_min",
table: "t_drill_params",
newName: "rotor_torque_min");
migrationBuilder.RenameColumn(
name: "top_drive_max",
table: "t_drill_params",
newName: "rotor_torque_max");
migrationBuilder.RenameColumn(
name: "top_drive_avg",
table: "t_drill_params",
newName: "rotor_torque_avg");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "rotor_torque_min",
table: "t_drill_params",
newName: "top_drive_min");
migrationBuilder.RenameColumn(
name: "rotor_torque_max",
table: "t_drill_params",
newName: "top_drive_max");
migrationBuilder.RenameColumn(
name: "rotor_torque_avg",
table: "t_drill_params",
newName: "top_drive_avg");
migrationBuilder.RenameColumn(
name: "rotor_speed_min",
table: "t_drill_params",
newName: "top_drive_speed_min");
migrationBuilder.RenameColumn(
name: "rotor_speed_max",
table: "t_drill_params",
newName: "top_drive_speed_max");
migrationBuilder.RenameColumn(
name: "rotor_speed_avg",
table: "t_drill_params",
newName: "top_drive_speed_avg");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_CompositeWell : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_сomposite_well",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита"),
Id = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
table.ForeignKey(
name: "t_сomposite_well_src_t_well_id_fk",
column: x => x.id_well_src,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_section_type_id_fk",
column: x => x.id_well_src,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Композитная скважина");
migrationBuilder.CreateIndex(
name: "IX_t_сomposite_well_id_well_src",
table: "t_сomposite_well",
column: "id_well_src");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_сomposite_well");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Remove_CompositeWell_id : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Id",
table: "t_сomposite_well");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Id",
table: "t_сomposite_well",
type: "integer",
nullable: false,
defaultValue: 0);
}
}
}

View File

@ -1,93 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_CompositeWell_to_WellComposite : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_сomposite_well");
migrationBuilder.CreateTable(
name: "t_well_сomposite",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_сomposite", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
table.ForeignKey(
name: "t_well_сomposite_src_t_well_id_fk",
column: x => x.id_well_src,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_well_сomposite_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
column: x => x.id_well_src,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Композитная скважина");
migrationBuilder.CreateIndex(
name: "IX_t_well_сomposite_id_well_src",
table: "t_well_сomposite",
column: "id_well_src");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_well_сomposite");
migrationBuilder.CreateTable(
name: "t_сomposite_well",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
},
constraints: table =>
{
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
table.ForeignKey(
name: "t_сomposite_well_src_t_well_id_fk",
column: x => x.id_well_src,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_section_type_id_fk",
column: x => x.id_well_src,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Композитная скважина");
migrationBuilder.CreateIndex(
name: "IX_t_сomposite_well_id_well_src",
table: "t_сomposite_well",
column: "id_well_src");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{
public partial class Add_Drill_Flow_Chart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_drill_flow_chart_params",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
well_id = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
last_update = table.Column<DateTime>(type: "timestamp without time zone", 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: "Глубина окончания интервала"),
axial_load_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальная нагрузка"),
axial_load_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальная нагрузка"),
pressure_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальное давление"),
pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальное давление"),
rotor_torque_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный момент на ВСП"),
rotor_torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный момент на ВСП"),
rotor_speed_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты на ВСП"),
rotor_speed_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальные обороты на ВСП"),
flow_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный расход"),
flow_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный расход")
},
constraints: table =>
{
table.PrimaryKey("PK_t_drill_flow_chart_params", x => x.id);
table.ForeignKey(
name: "FK_t_drill_flow_chart_params_t_well_well_id",
column: x => x.well_id,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Параметры корридоров бурения (диапазоны параметров бурения)");
migrationBuilder.CreateIndex(
name: "IX_t_drill_flow_chart_params_well_id",
table: "t_drill_flow_chart_params",
column: "well_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_drill_flow_chart_params");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Fix_WellComposite_FK : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite");
migrationBuilder.CreateIndex(
name: "IX_t_well_сomposite_id_well_section_type",
table: "t_well_сomposite",
column: "id_well_section_type");
migrationBuilder.AddForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite",
column: "id_well_section_type",
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite");
migrationBuilder.DropIndex(
name: "IX_t_well_сomposite_id_well_section_type",
table: "t_well_сomposite");
migrationBuilder.AddForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite",
column: "id_well_src",
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1,73 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_DrillFlowChartParams_to_DrillFlowChart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_drill_flow_chart_params_t_well_well_id",
table: "t_drill_flow_chart_params");
migrationBuilder.DropPrimaryKey(
name: "PK_t_drill_flow_chart_params",
table: "t_drill_flow_chart_params");
migrationBuilder.RenameTable(
name: "t_drill_flow_chart_params",
newName: "t_drill_flow_chart");
migrationBuilder.RenameIndex(
name: "IX_t_drill_flow_chart_params_well_id",
table: "t_drill_flow_chart",
newName: "IX_t_drill_flow_chart_well_id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_drill_flow_chart",
table: "t_drill_flow_chart",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_drill_flow_chart_t_well_well_id",
table: "t_drill_flow_chart",
column: "well_id",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_drill_flow_chart_t_well_well_id",
table: "t_drill_flow_chart");
migrationBuilder.DropPrimaryKey(
name: "PK_t_drill_flow_chart",
table: "t_drill_flow_chart");
migrationBuilder.RenameTable(
name: "t_drill_flow_chart",
newName: "t_drill_flow_chart_params");
migrationBuilder.RenameIndex(
name: "IX_t_drill_flow_chart_well_id",
table: "t_drill_flow_chart_params",
newName: "IX_t_drill_flow_chart_params_well_id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_drill_flow_chart_params",
table: "t_drill_flow_chart_params",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_drill_flow_chart_params_t_well_well_id",
table: "t_drill_flow_chart_params",
column: "well_id",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1,34 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Added_DrillFlowChart_OperationCategory_Index : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "id_operation_category",
table: "t_drill_flow_chart",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Id типа операции");
migrationBuilder.CreateIndex(
name: "IX_t_drill_flow_chart_id_operation_category",
table: "t_drill_flow_chart",
column: "id_operation_category");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_t_drill_flow_chart_id_operation_category",
table: "t_drill_flow_chart");
migrationBuilder.DropColumn(
name: "id_operation_category",
table: "t_drill_flow_chart");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_Well_State : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "state",
table: "t_well",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0 - неизвестно, 1 - в работе, 2 - завершена");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "state",
table: "t_well");
}
}
}

View File

@ -1,27 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Edit_WellOperationCategory_DefaultData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1001,
column: "name",
value: "Бурение");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1001,
column: "name",
value: "Бурение в интервале");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_Well_State_to_IdState : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_WebUrl_In_FileInfo : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "web_storage_url",
table: "t_file_info",
type: "text",
nullable: true,
comment: "Ссылка для просмотра файла в облаке");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "web_storage_url",
table: "t_file_info");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_PublishInfo_To_FileInfo : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "web_storage_url",
table: "t_file_info");
migrationBuilder.AddColumn<FilePublishInfo>(
name: "publish_info",
table: "t_file_info",
type: "jsonb",
nullable: true,
comment: "Информация о файле в облаке");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "publish_info",
table: "t_file_info");
migrationBuilder.AddColumn<string>(
name: "web_storage_url",
table: "t_file_info",
type: "text",
nullable: true,
comment: "Ссылка для просмотра файла в облаке");
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{
public partial class Add_File_Marks : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_file_mark",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_mark = table.Column<int>(type: "integer", nullable: false, comment: "0 - Согласован, \n1 - Отредактирован"),
date_created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "Дата совершенного действия"),
id_file = table.Column<int>(type: "integer", nullable: false, comment: "id файла"),
id_user = table.Column<int>(type: "integer", nullable: false, comment: "id пользователя"),
comment = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Комментарий"),
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Помечен ли файл как удаленный")
},
constraints: table =>
{
table.PrimaryKey("PK_t_file_mark", x => x.id);
table.ForeignKey(
name: "t_file_mark_t_file_info_fk",
column: x => x.id_file,
principalTable: "t_file_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_user_t_file_mark_fk",
column: x => x.id_user,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Действия с файлами.");
migrationBuilder.CreateIndex(
name: "IX_t_file_mark_id_file",
table: "t_file_mark",
column: "id_file");
migrationBuilder.CreateIndex(
name: "IX_t_file_mark_id_user",
table: "t_file_mark",
column: "id_user");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_file_mark");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Change_File_Mark_Comment : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "id_mark",
table: "t_file_mark",
type: "integer",
nullable: false,
comment: "0 - Согласован, \n1 - Уже внесен в программу бурения",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "0 - Согласован, \n1 - Отредактирован");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "id_mark",
table: "t_file_mark",
type: "integer",
nullable: false,
comment: "0 - Согласован, \n1 - Отредактирован",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "0 - Согласован, \n1 - Уже внесен в программу бурения");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_IdMark_To_IdMarkType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "id_mark",
table: "t_file_mark");
migrationBuilder.AddColumn<int>(
name: "id_mark_type",
table: "t_file_mark",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0 - Согласован");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "id_mark_type",
table: "t_file_mark");
migrationBuilder.AddColumn<int>(
name: "id_mark",
table: "t_file_mark",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0 - Согласован, \n1 - Уже внесен в программу бурения");
}
}
}

View File

@ -1,92 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Replace_PK_of_telemetryData_to_compositeKey : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin");
migrationBuilder.DropIndex(
name: "IX_t_telemetry_data_spin_id_telemetry",
table: "t_telemetry_data_spin");
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub");
migrationBuilder.DropIndex(
name: "IX_t_telemetry_data_saub_id_telemetry",
table: "t_telemetry_data_saub");
migrationBuilder.DropColumn(
name: "id",
table: "t_telemetry_data_spin");
migrationBuilder.DropColumn(
name: "id",
table: "t_telemetry_data_saub");
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin",
columns: new[] { "id_telemetry", "date" });
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub",
columns: new[] { "id_telemetry", "date" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin");
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub");
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_telemetry_data_spin",
type: "integer",
nullable: false,
defaultValue: 0)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_telemetry_data_saub",
type: "integer",
nullable: false,
defaultValue: 0)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin",
column: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub",
column: "id");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_data_spin_id_telemetry",
table: "t_telemetry_data_spin",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_data_saub_id_telemetry",
table: "t_telemetry_data_saub",
column: "id_telemetry");
}
}
}

View File

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Fix_telemetrydataspin_field_name : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "encoder_resolution ",
table: "t_telemetry_data_spin",
newName: "encoder_resolution");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "encoder_resolution",
table: "t_telemetry_data_spin",
newName: "encoder_resolution ");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_Telemetry_TimeZone : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<SimpleTimezone>(
name: "timezone",
table: "t_telemetry",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "timezone",
table: "t_telemetry");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,185 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Add_UserRoles_Permissions : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_user_t_user_role_id_role",
table: "t_user");
migrationBuilder.DropIndex(
name: "IX_t_user_id_role",
table: "t_user");
migrationBuilder.DropColumn(
name: "id_role",
table: "t_user");
migrationBuilder.DropColumn(
name: "level",
table: "t_user");
migrationBuilder.AddColumn<int>(
name: "id_parent",
table: "t_user_role",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "От какой роли унаследована данная роль");
migrationBuilder.AddColumn<int>(
name: "role_type",
table: "t_user_role",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя");
migrationBuilder.CreateTable(
name: "t_permission",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название"),
type = table.Column<int>(type: "integer", nullable: false, comment: "1-чтение, 2-запись, 3-чтение и запись")
},
constraints: table =>
{
table.PrimaryKey("PK_t_permission", x => x.id);
},
comment: "Разрешения на доступ к данным");
migrationBuilder.CreateTable(
name: "t_relation_user_user_role",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_user = table.Column<int>(type: "integer", nullable: false),
id_user_role = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_user_user_role", x => x.id);
table.ForeignKey(
name: "FK_t_relation_user_user_role_t_user_id_user",
column: x => x.id_user,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_user_role_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение пользователей и ролей");
migrationBuilder.CreateTable(
name: "t_relation_user_role_permission",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_user_role = table.Column<int>(type: "integer", nullable: false),
id_permission = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_user_role_permission", x => x.id);
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_permission_id_permission",
column: x => x.id_permission,
principalTable: "t_permission",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение ролей пользователей и разрешений доступа");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_permission",
table: "t_relation_user_role_permission",
column: "id_permission");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_user_role",
table: "t_relation_user_role_permission",
column: "id_user_role");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_user_role_id_user",
table: "t_relation_user_user_role",
column: "id_user");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_user_role_id_user_role",
table: "t_relation_user_user_role",
column: "id_user_role");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_relation_user_role_permission");
migrationBuilder.DropTable(
name: "t_relation_user_user_role");
migrationBuilder.DropTable(
name: "t_permission");
migrationBuilder.DropColumn(
name: "id_parent",
table: "t_user_role");
migrationBuilder.DropColumn(
name: "role_type",
table: "t_user_role");
migrationBuilder.AddColumn<int>(
name: "id_role",
table: "t_user",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "level",
table: "t_user",
type: "integer",
nullable: true);
migrationBuilder.UpdateData(
table: "t_user",
keyColumn: "id",
keyValue: 1,
columns: new[] { "id_role", "level" },
values: new object[] { 1, 2147483647 });
migrationBuilder.CreateIndex(
name: "IX_t_user_id_role",
table: "t_user",
column: "id_role");
migrationBuilder.AddForeignKey(
name: "FK_t_user_t_user_role_id_role",
table: "t_user",
column: "id_role",
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{
public partial class AddSetpoints : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_setpoints_rquest",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Id пользователя, загрузившего файл"),
id_state = table.Column<int>(type: "integer", nullable: false, comment: "0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
obsolescence = table.Column<int>(type: "integer", nullable: false, comment: "сек. до устаревания"),
setpoint_set = table.Column<Dictionary<string, double>>(type: "jsonb", nullable: true, comment: "Набор уставок"),
comment = table.Column<string>(type: "text", nullable: true, comment: "комментарий для оператора")
},
constraints: table =>
{
table.PrimaryKey("PK_t_setpoints_rquest", x => x.id);
table.ForeignKey(
name: "FK_t_setpoints_rquest_t_user_id_author",
column: x => x.id_author,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_setpoints_rquest_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Запросы на изменение уставок панели оператора");
migrationBuilder.CreateIndex(
name: "IX_t_setpoints_rquest_id_author",
table: "t_setpoints_rquest",
column: "id_author");
migrationBuilder.CreateIndex(
name: "IX_t_setpoints_rquest_id_well",
table: "t_setpoints_rquest",
column: "id_well");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_setpoints_rquest");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,223 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Fixed_Role_Permissions_Value : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_relation_user_user_role",
table: "t_relation_user_user_role");
migrationBuilder.DropIndex(
name: "IX_t_relation_user_user_role_id_user",
table: "t_relation_user_user_role");
migrationBuilder.DropPrimaryKey(
name: "PK_t_relation_user_role_permission",
table: "t_relation_user_role_permission");
migrationBuilder.DropIndex(
name: "IX_t_relation_user_role_permission_id_user_role",
table: "t_relation_user_role_permission");
migrationBuilder.DropColumn(
name: "id",
table: "t_relation_user_user_role");
migrationBuilder.DropColumn(
name: "type",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "role_type",
table: "t_user_role",
newName: "id_type");
migrationBuilder.RenameColumn(
name: "id",
table: "t_relation_user_role_permission",
newName: "permission_value");
migrationBuilder.RenameColumn(
name: "caption",
table: "t_permission",
newName: "name");
migrationBuilder.AlterColumn<int>(
name: "id_parent",
table: "t_user_role",
type: "integer",
nullable: true,
comment: "От какой роли унаследована данная роль",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "От какой роли унаследована данная роль");
migrationBuilder.AlterColumn<int>(
name: "permission_value",
table: "t_relation_user_role_permission",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<string>(
name: "bit_description",
table: "t_permission",
type: "jsonb",
nullable: true,
comment: "Описание каждого бита разрешений");
migrationBuilder.AddColumn<string>(
name: "description",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Краткое описание");
migrationBuilder.AddPrimaryKey(
name: "PK_t_relation_user_user_role",
table: "t_relation_user_user_role",
columns: new[] { "id_user", "id_user_role" });
migrationBuilder.AddPrimaryKey(
name: "PK_t_relation_user_role_permission",
table: "t_relation_user_role_permission",
columns: new[] { "id_user_role", "id_permission" });
migrationBuilder.InsertData(
table: "t_relation_user_user_role",
columns: new[] { "id_user", "id_user_role" },
values: new object[] { 1, 2 });
migrationBuilder.UpdateData(
table: "t_user_role",
keyColumn: "id",
keyValue: 1,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_user_role",
keyColumn: "id",
keyValue: 2,
column: "id_parent",
value: null);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_relation_user_user_role",
table: "t_relation_user_user_role");
migrationBuilder.DropPrimaryKey(
name: "PK_t_relation_user_role_permission",
table: "t_relation_user_role_permission");
migrationBuilder.DeleteData(
table: "t_relation_user_user_role",
keyColumns: new[] { "id_user", "id_user_role" },
keyValues: new object[] { 1, 2 });
migrationBuilder.DropColumn(
name: "bit_description",
table: "t_permission");
migrationBuilder.DropColumn(
name: "description",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "id_type",
table: "t_user_role",
newName: "role_type");
migrationBuilder.RenameColumn(
name: "permission_value",
table: "t_relation_user_role_permission",
newName: "id");
migrationBuilder.RenameColumn(
name: "name",
table: "t_permission",
newName: "caption");
migrationBuilder.AlterColumn<int>(
name: "id_parent",
table: "t_user_role",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "От какой роли унаследована данная роль",
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true,
oldComment: "От какой роли унаследована данная роль");
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_relation_user_user_role",
type: "integer",
nullable: false,
defaultValue: 0)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AlterColumn<int>(
name: "id",
table: "t_relation_user_role_permission",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<int>(
name: "type",
table: "t_permission",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "1-чтение, 2-запись, 3-чтение и запись");
migrationBuilder.AddPrimaryKey(
name: "PK_t_relation_user_user_role",
table: "t_relation_user_user_role",
column: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_relation_user_role_permission",
table: "t_relation_user_role_permission",
column: "id");
migrationBuilder.UpdateData(
table: "t_user_role",
keyColumn: "id",
keyValue: 1,
column: "id_parent",
value: 0);
migrationBuilder.UpdateData(
table: "t_user_role",
keyColumn: "id",
keyValue: 2,
column: "id_parent",
value: 0);
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_user_role_id_user",
table: "t_relation_user_user_role",
column: "id_user");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_user_role",
table: "t_relation_user_role_permission",
column: "id_user_role");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,214 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{
public partial class Renamed_Permissions_Tables : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_relation_user_role_permission");
migrationBuilder.DropPrimaryKey(
name: "PK_t_permission",
table: "t_permission");
migrationBuilder.DropColumn(
name: "bit_description",
table: "t_permission");
migrationBuilder.DropColumn(
name: "description",
table: "t_permission");
migrationBuilder.DropColumn(
name: "name",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "id",
table: "t_permission",
newName: "permission_value");
migrationBuilder.AlterTable(
name: "t_permission",
comment: "Отношение ролей пользователей и разрешений доступа",
oldComment: "Разрешения на доступ к данным");
migrationBuilder.AlterColumn<int>(
name: "permission_value",
table: "t_permission",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<int>(
name: "id_user_role",
table: "t_permission",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "id_permission",
table: "t_permission",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_t_permission",
table: "t_permission",
columns: new[] { "id_user_role", "id_permission" });
migrationBuilder.CreateTable(
name: "t_permission_info",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название"),
description = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Краткое описание"),
bit_description = table.Column<IDictionary<int, string>>(type: "jsonb", nullable: true, comment: "Описание каждого бита разрешений")
},
constraints: table =>
{
table.PrimaryKey("PK_t_permission_info", x => x.id);
},
comment: "Разрешения на доступ к данным");
migrationBuilder.CreateIndex(
name: "IX_t_permission_id_permission",
table: "t_permission",
column: "id_permission");
migrationBuilder.AddForeignKey(
name: "FK_t_permission_t_permission_info_id_permission",
table: "t_permission",
column: "id_permission",
principalTable: "t_permission_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_permission_t_user_role_id_user_role",
table: "t_permission",
column: "id_user_role",
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_permission_t_permission_info_id_permission",
table: "t_permission");
migrationBuilder.DropForeignKey(
name: "FK_t_permission_t_user_role_id_user_role",
table: "t_permission");
migrationBuilder.DropTable(
name: "t_permission_info");
migrationBuilder.DropPrimaryKey(
name: "PK_t_permission",
table: "t_permission");
migrationBuilder.DropIndex(
name: "IX_t_permission_id_permission",
table: "t_permission");
migrationBuilder.DropColumn(
name: "id_user_role",
table: "t_permission");
migrationBuilder.DropColumn(
name: "id_permission",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "permission_value",
table: "t_permission",
newName: "id");
migrationBuilder.AlterTable(
name: "t_permission",
comment: "Разрешения на доступ к данным",
oldComment: "Отношение ролей пользователей и разрешений доступа");
migrationBuilder.AlterColumn<int>(
name: "id",
table: "t_permission",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<string>(
name: "bit_description",
table: "t_permission",
type: "jsonb",
nullable: true,
comment: "Описание каждого бита разрешений");
migrationBuilder.AddColumn<string>(
name: "description",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Краткое описание");
migrationBuilder.AddColumn<string>(
name: "name",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Название");
migrationBuilder.AddPrimaryKey(
name: "PK_t_permission",
table: "t_permission",
column: "id");
migrationBuilder.CreateTable(
name: "t_relation_user_role_permission",
columns: table => new
{
id_user_role = table.Column<int>(type: "integer", nullable: false),
id_permission = table.Column<int>(type: "integer", nullable: false),
permission_value = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_user_role_permission", x => new { x.id_user_role, x.id_permission });
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_permission_id_permission",
column: x => x.id_permission,
principalTable: "t_permission",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение ролей пользователей и разрешений доступа");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_permission",
table: "t_relation_user_role_permission",
column: "id_permission");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Renamed_PermissionCollections : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Renamed_Permission_Role_Files : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class RenameTable_WellComposite : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_well_сomposite",
table: "t_well_сomposite");
migrationBuilder.RenameTable(
name: "t_well_сomposite",
newName: "t_well_composite");
migrationBuilder.RenameIndex(
name: "IX_t_well_сomposite_id_well_src",
table: "t_well_composite",
newName: "IX_t_well_composite_id_well_src");
migrationBuilder.RenameIndex(
name: "IX_t_well_сomposite_id_well_section_type",
table: "t_well_composite",
newName: "IX_t_well_composite_id_well_section_type");
migrationBuilder.AddPrimaryKey(
name: "PK_t_well_composite",
table: "t_well_composite",
columns: new[] { "id_well", "id_well_src", "id_well_section_type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_well_composite",
table: "t_well_composite");
migrationBuilder.RenameTable(
name: "t_well_composite",
newName: "t_well_сomposite");
migrationBuilder.RenameIndex(
name: "IX_t_well_composite_id_well_src",
table: "t_well_сomposite",
newName: "IX_t_well_сomposite_id_well_src");
migrationBuilder.RenameIndex(
name: "IX_t_well_composite_id_well_section_type",
table: "t_well_сomposite",
newName: "IX_t_well_сomposite_id_well_section_type");
migrationBuilder.AddPrimaryKey(
name: "PK_t_well_сomposite",
table: "t_well_сomposite",
columns: new[] { "id_well", "id_well_src", "id_well_section_type" });
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Update_operations_list : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1009);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1010);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1036);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1023,
column: "name",
value: "Сборка инструмента с мостков");
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[,]
{
{ 1051, 0, "Замер ТС" },
{ 1052, 0, "Тех. отстой" },
{ 1053, 0, "Циркуляция и Обработка БР" },
{ 1054, 0, "Срезка ствола" },
{ 1055, 0, "Вспомогательные работы" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1051);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1052);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1053);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1054);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1055);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1023,
column: "name",
value: "Сборка инструмента");
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[,]
{
{ 1009, 0, "Оборудование устья" },
{ 1010, 0, "ОЗЦ" },
{ 1036, 0, "Спуск обсадной колонны" }
});
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_Permissions_fields : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_permission_t_permission_info_id_permission",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "permission_value",
table: "t_permission",
newName: "value");
migrationBuilder.RenameColumn(
name: "id_permission",
table: "t_permission",
newName: "id_permission_info");
migrationBuilder.RenameIndex(
name: "IX_t_permission_id_permission",
table: "t_permission",
newName: "IX_t_permission_id_permission_info");
migrationBuilder.AddForeignKey(
name: "FK_t_permission_t_permission_info_id_permission_info",
table: "t_permission",
column: "id_permission_info",
principalTable: "t_permission_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_permission_t_permission_info_id_permission_info",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "value",
table: "t_permission",
newName: "permission_value");
migrationBuilder.RenameColumn(
name: "id_permission_info",
table: "t_permission",
newName: "id_permission");
migrationBuilder.RenameIndex(
name: "IX_t_permission_id_permission_info",
table: "t_permission",
newName: "IX_t_permission_id_permission");
migrationBuilder.AddForeignKey(
name: "FK_t_permission_t_permission_info_id_permission",
table: "t_permission",
column: "id_permission",
principalTable: "t_permission_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,214 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{
public partial class RemovedPermissionValues : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_permission_t_permission_info_id_permission_info",
table: "t_permission");
migrationBuilder.DropForeignKey(
name: "FK_t_permission_t_user_role_id_user_role",
table: "t_permission");
migrationBuilder.DropTable(
name: "t_permission_info");
migrationBuilder.DropPrimaryKey(
name: "PK_t_permission",
table: "t_permission");
migrationBuilder.DropIndex(
name: "IX_t_permission_id_permission_info",
table: "t_permission");
migrationBuilder.DropColumn(
name: "id_user_role",
table: "t_permission");
migrationBuilder.DropColumn(
name: "id_permission_info",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "value",
table: "t_permission",
newName: "id");
migrationBuilder.AlterTable(
name: "t_permission",
comment: "Разрешения на доступ к данным",
oldComment: "Отношение ролей пользователей и разрешений доступа");
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_relation_user_user_role",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<int>(
name: "id",
table: "t_permission",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<string>(
name: "description",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Краткое описание");
migrationBuilder.AddColumn<string>(
name: "name",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Название");
migrationBuilder.AddPrimaryKey(
name: "PK_t_permission",
table: "t_permission",
column: "id");
migrationBuilder.CreateTable(
name: "t_relation_user_role_permission",
columns: table => new
{
id_user_role = table.Column<int>(type: "integer", nullable: false),
id_permission = table.Column<int>(type: "integer", nullable: false),
id = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_user_role_permission", x => new { x.id_user_role, x.id_permission });
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_permission_id_permission",
column: x => x.id_permission,
principalTable: "t_permission",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение ролей пользователей и разрешений доступа");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_permission",
table: "t_relation_user_role_permission",
column: "id_permission");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_relation_user_role_permission");
migrationBuilder.DropPrimaryKey(
name: "PK_t_permission",
table: "t_permission");
migrationBuilder.DropColumn(
name: "id",
table: "t_relation_user_user_role");
migrationBuilder.DropColumn(
name: "description",
table: "t_permission");
migrationBuilder.DropColumn(
name: "name",
table: "t_permission");
migrationBuilder.RenameColumn(
name: "id",
table: "t_permission",
newName: "value");
migrationBuilder.AlterTable(
name: "t_permission",
comment: "Отношение ролей пользователей и разрешений доступа",
oldComment: "Разрешения на доступ к данным");
migrationBuilder.AlterColumn<int>(
name: "value",
table: "t_permission",
type: "integer",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<int>(
name: "id_user_role",
table: "t_permission",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "id_permission_info",
table: "t_permission",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_t_permission",
table: "t_permission",
columns: new[] { "id_user_role", "id_permission_info" });
migrationBuilder.CreateTable(
name: "t_permission_info",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
bit_description = table.Column<IDictionary<int, string>>(type: "jsonb", nullable: true, comment: "Описание каждого бита разрешений"),
description = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Краткое описание"),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_permission_info", x => x.id);
},
comment: "Разрешения на доступ к данным");
migrationBuilder.CreateIndex(
name: "IX_t_permission_id_permission_info",
table: "t_permission",
column: "id_permission_info");
migrationBuilder.AddForeignKey(
name: "FK_t_permission_t_permission_info_id_permission_info",
table: "t_permission",
column: "id_permission_info",
principalTable: "t_permission_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_permission_t_user_role_id_user_role",
table: "t_permission",
column: "id_user_role",
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1,35 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class RemovedIdFromPermissionRelations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "id",
table: "t_relation_user_user_role");
migrationBuilder.DropColumn(
name: "id",
table: "t_relation_user_role_permission");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_relation_user_user_role",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_relation_user_role_permission",
type: "integer",
nullable: false,
defaultValue: 0);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class RenameDocsCategories : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_file_category",
keyColumn: "id",
keyValue: 11);
migrationBuilder.UpdateData(
table: "t_file_category",
keyColumn: "id",
keyValue: 8,
columns: new[] { "name", "short_name" },
values: new object[] { "Долотный сервис", "toolService" });
migrationBuilder.UpdateData(
table: "t_file_category",
keyColumn: "id",
keyValue: 9,
columns: new[] { "name", "short_name" },
values: new object[] { "Буровой подрядчик", "drillService" });
migrationBuilder.UpdateData(
table: "t_file_category",
keyColumn: "id",
keyValue: 10,
columns: new[] { "name", "short_name" },
values: new object[] { "Сервис по заканчиванию скважины", "closingService" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_file_category",
keyColumn: "id",
keyValue: 8,
columns: new[] { "name", "short_name" },
values: new object[] { "Последний замер бурового раствора ПЛАН", "fluidPlanLastData" });
migrationBuilder.UpdateData(
table: "t_file_category",
keyColumn: "id",
keyValue: 9,
columns: new[] { "name", "short_name" },
values: new object[] { "Последний замер бурового раствора ФАКТ", "fluidFactLastData" });
migrationBuilder.UpdateData(
table: "t_file_category",
keyColumn: "id",
keyValue: 10,
columns: new[] { "name", "short_name" },
values: new object[] { "Последние данные Шламограммы", "mudLastData" });
migrationBuilder.InsertData(
table: "t_file_category",
columns: new[] { "id", "name", "short_name" },
values: new object[] { 11, "Последние данные ННБ", "nnbLastData" });
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,248 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddedNewSectionTypes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "caption",
value: "Пилотный ствол 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 2,
column: "caption",
value: "Пилотный ствол 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "caption",
value: "Пилотный ствол 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "caption",
value: "Пилотный ствол 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "caption",
value: "Пилотный ствол 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "caption",
value: "Направление 1");
migrationBuilder.InsertData(
table: "t_well_section_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 30, "Хвостовик 5" },
{ 29, "Хвостовик 4" },
{ 28, "Хвостовик 3" },
{ 27, "Хвостовик 2" },
{ 26, "Хвостовик 1" },
{ 25, "Транспортный ствол 5" },
{ 24, "Транспортный ствол 4" },
{ 23, "Транспортный ствол 3" },
{ 22, "Транспортный ствол 2" },
{ 21, "Транспортный ствол 1" },
{ 19, "Эксплуатационная колонна 4" },
{ 18, "Эксплуатационная колонна 3" },
{ 17, "Эксплуатационная колонна 2" },
{ 16, "Эксплуатационная колонна 1" },
{ 15, "Кондуктор 5" },
{ 14, "Кондуктор 4" },
{ 13, "Кондуктор 3" },
{ 12, "Кондуктор 2" },
{ 11, "Кондуктор 1" },
{ 10, "Направление 5" },
{ 9, "Направление 4" },
{ 8, "Направление 3" },
{ 20, "Эксплуатационная колонна 5" },
{ 7, "Направление 2" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 7);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 8);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 9);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 10);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 11);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 12);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 13);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 14);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 15);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 16);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 17);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 18);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 19);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 20);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 21);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 22);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 23);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 24);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 25);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 26);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 27);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 28);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 29);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 30);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "caption",
value: "Пилотный ствол");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 2,
column: "caption",
value: "Направление");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "caption",
value: "Кондуктор");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "caption",
value: "Эксплуатационная колонна");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "caption",
value: "Транспортный ствол");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "caption",
value: "Хвостовик");
}
}
}

View File

@ -1,405 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Reorder_SectionsTypes_to_keep_existing_operations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 2,
column: "caption",
value: "Направление 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "caption",
value: "Кондуктор 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "caption",
value: "Эксплуатационная колонна 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "caption",
value: "Транспортный ствол 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "caption",
value: "Хвостовик 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 7,
column: "caption",
value: "Пилотный ствол 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 8,
column: "caption",
value: "Направление 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 9,
column: "caption",
value: "Кондуктор 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 10,
column: "caption",
value: "Эксплуатационная колонна 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 11,
column: "caption",
value: "Транспортный ствол 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 12,
column: "caption",
value: "Хвостовик 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 13,
column: "caption",
value: "Пилотный ствол 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 14,
column: "caption",
value: "Направление 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 15,
column: "caption",
value: "Кондуктор 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 16,
column: "caption",
value: "Эксплуатационная колонна 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 17,
column: "caption",
value: "Транспортный ствол 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 18,
column: "caption",
value: "Хвостовик 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 19,
column: "caption",
value: "Пилотный ствол 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 20,
column: "caption",
value: "Направление 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 21,
column: "caption",
value: "Кондуктор 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 22,
column: "caption",
value: "Эксплуатационная колонна 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 23,
column: "caption",
value: "Транспортный ствол 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 24,
column: "caption",
value: "Хвостовик 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 25,
column: "caption",
value: "Пилотный ствол 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 26,
column: "caption",
value: "Направление 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 27,
column: "caption",
value: "Кондуктор 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 28,
column: "caption",
value: "Эксплуатационная колонна 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 29,
column: "caption",
value: "Транспортный ствол 5");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 2,
column: "caption",
value: "Пилотный ствол 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "caption",
value: "Пилотный ствол 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "caption",
value: "Пилотный ствол 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "caption",
value: "Пилотный ствол 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "caption",
value: "Направление 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 7,
column: "caption",
value: "Направление 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 8,
column: "caption",
value: "Направление 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 9,
column: "caption",
value: "Направление 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 10,
column: "caption",
value: "Направление 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 11,
column: "caption",
value: "Кондуктор 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 12,
column: "caption",
value: "Кондуктор 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 13,
column: "caption",
value: "Кондуктор 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 14,
column: "caption",
value: "Кондуктор 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 15,
column: "caption",
value: "Кондуктор 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 16,
column: "caption",
value: "Эксплуатационная колонна 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 17,
column: "caption",
value: "Эксплуатационная колонна 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 18,
column: "caption",
value: "Эксплуатационная колонна 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 19,
column: "caption",
value: "Эксплуатационная колонна 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 20,
column: "caption",
value: "Эксплуатационная колонна 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 21,
column: "caption",
value: "Транспортный ствол 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 22,
column: "caption",
value: "Транспортный ствол 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 23,
column: "caption",
value: "Транспортный ствол 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 24,
column: "caption",
value: "Транспортный ствол 4");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 25,
column: "caption",
value: "Транспортный ствол 5");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 26,
column: "caption",
value: "Хвостовик 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 27,
column: "caption",
value: "Хвостовик 2");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 28,
column: "caption",
value: "Хвостовик 3");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 29,
column: "caption",
value: "Хвостовик 4");
}
}
}

View File

@ -1,94 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace AsbCloudDb.Migrations
{
public partial class Specify_type_for_datetime_props : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "date_start",
table: "t_well_operation",
type: "timestamp with time zone",
nullable: false,
comment: "Дата начала операции",
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldComment: "Дата начала операции");
migrationBuilder.AlterColumn<DateTime>(
name: "timestamp",
table: "t_measure",
type: "timestamp with time zone",
nullable: false,
comment: "время добавления",
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldComment: "время добавления");
migrationBuilder.AlterColumn<DateTime>(
name: "date_created",
table: "t_file_mark",
type: "timestamp with time zone",
nullable: false,
comment: "Дата совершенного действия",
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldComment: "Дата совершенного действия");
migrationBuilder.AlterColumn<DateTime>(
name: "last_update",
table: "t_drill_flow_chart",
type: "timestamp with time zone",
nullable: false,
comment: "Дата последнего изменения",
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldComment: "Дата последнего изменения");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "date_start",
table: "t_well_operation",
type: "timestamp without time zone",
nullable: false,
comment: "Дата начала операции",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldComment: "Дата начала операции");
migrationBuilder.AlterColumn<DateTime>(
name: "timestamp",
table: "t_measure",
type: "timestamp without time zone",
nullable: false,
comment: "время добавления",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldComment: "время добавления");
migrationBuilder.AlterColumn<DateTime>(
name: "date_created",
table: "t_file_mark",
type: "timestamp without time zone",
nullable: false,
comment: "Дата совершенного действия",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldComment: "Дата совершенного действия");
migrationBuilder.AlterColumn<DateTime>(
name: "last_update",
table: "t_drill_flow_chart",
type: "timestamp without time zone",
nullable: false,
comment: "Дата последнего изменения",
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldComment: "Дата последнего изменения");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,113 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Fix_spelling_of_defaults : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1014,
column: "name",
value: "Опрессовка Ц.К.");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "caption",
value: "Пилотный ствол");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 2,
column: "caption",
value: "Направление");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "caption",
value: "Кондуктор");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "caption",
value: "Эксплуатационная колонна");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "caption",
value: "Транспортный ствол");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "caption",
value: "Хвостовик");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1014,
column: "name",
value: "Опресовка Ц.К.");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "caption",
value: "Пилотный ствол 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 2,
column: "caption",
value: "Направление 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "caption",
value: "Кондуктор 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "caption",
value: "Эксплуатационная колонна 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "caption",
value: "Транспортный ствол 1");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "caption",
value: "Хвостовик 1");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_timeZone_to_IMapPoint : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<SimpleTimezone>(
name: "timezone",
table: "t_well",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC");
migrationBuilder.AddColumn<SimpleTimezone>(
name: "timezone",
table: "t_deposit",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC");
migrationBuilder.AddColumn<SimpleTimezone>(
name: "timezone",
table: "t_cluster",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "timezone",
table: "t_well");
migrationBuilder.DropColumn(
name: "timezone",
table: "t_deposit");
migrationBuilder.DropColumn(
name: "timezone",
table: "t_cluster");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Fix_Spelling : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterTable(
name: "t_drill_flow_chart",
comment: "Параметры коридоров бурения (диапазоны параметров бурения)",
oldComment: "Параметры корридоров бурения (диапазоны параметров бурения)");
migrationBuilder.AlterColumn<float>(
name: "torque_starting",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Страгивающий момент",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: " Страгивающий момент");
migrationBuilder.AlterColumn<float>(
name: "rotor_torque_avg",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Момент в роторе средний",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: " Момент в роторе средний");
migrationBuilder.AlterColumn<float>(
name: "ratio",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: " Коэффициент редукции редуктора",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: " Коэффициент редукции редектора");
migrationBuilder.AlterColumn<float>(
name: "position_zero",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Нулевая позиция осцилляции",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Нулевая позиция осциляции");
migrationBuilder.AlterColumn<float>(
name: "position_right",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Крайний правый угол осцилляции",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Крайний правый угол осциляции");
migrationBuilder.AlterColumn<float>(
name: "encoder_resolution",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Разрешение энкодера",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: " Разрешение энкодера");
migrationBuilder.AlterColumn<bool>(
name: "is_pressure_gt_20",
table: "t_telemetry_analysis",
type: "boolean",
nullable: false,
comment: "Давление более 20",
oldClrType: typeof(bool),
oldType: "boolean",
oldComment: "Давоение более 20");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterTable(
name: "t_drill_flow_chart",
comment: "Параметры корридоров бурения (диапазоны параметров бурения)",
oldComment: "Параметры коридоров бурения (диапазоны параметров бурения)");
migrationBuilder.AlterColumn<float>(
name: "torque_starting",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: " Страгивающий момент",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Страгивающий момент");
migrationBuilder.AlterColumn<float>(
name: "rotor_torque_avg",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: " Момент в роторе средний",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Момент в роторе средний");
migrationBuilder.AlterColumn<float>(
name: "ratio",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: " Коэффициент редукции редектора",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: " Коэффициент редукции редуктора");
migrationBuilder.AlterColumn<float>(
name: "position_zero",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Нулевая позиция осциляции",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Нулевая позиция осцилляции");
migrationBuilder.AlterColumn<float>(
name: "position_right",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: "Крайний правый угол осциляции",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Крайний правый угол осцилляции");
migrationBuilder.AlterColumn<float>(
name: "encoder_resolution",
table: "t_telemetry_data_spin",
type: "real",
nullable: true,
comment: " Разрешение энкодера",
oldClrType: typeof(float),
oldType: "real",
oldNullable: true,
oldComment: "Разрешение энкодера");
migrationBuilder.AlterColumn<bool>(
name: "is_pressure_gt_20",
table: "t_telemetry_analysis",
type: "boolean",
nullable: false,
comment: "Давоение более 20",
oldClrType: typeof(bool),
oldType: "boolean",
oldComment: "Давление более 20");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Refactor_UserRole : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "id_parent",
table: "t_user_role");
migrationBuilder.CreateTable(
name: "t_relation_user_role_user_role",
columns: table => new
{
id_user_role = table.Column<int>(type: "integer", nullable: false),
id_include_user_role = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("t_relation_user_role_user_role_pk", x => new { x.id_user_role, x.id_include_user_role });
table.ForeignKey(
name: "FK_t_relation_user_role_user_role_t_user_role_id_include_user_~",
column: x => x.id_include_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_role_user_role_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение ролей к ролям");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_user_role_id_include_user_role",
table: "t_relation_user_role_user_role",
column: "id_include_user_role");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_relation_user_role_user_role");
migrationBuilder.AddColumn<int>(
name: "id_parent",
table: "t_user_role",
type: "integer",
nullable: true,
comment: "От какой роли унаследована данная роль");
}
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More