diff --git a/AsbCloudDb/Migrations/20210907085527_Init.Designer.cs b/AsbCloudDb/Migrations/20210907085527_Init.Designer.cs
new file mode 100644
index 00000000..295737f7
--- /dev/null
+++ b/AsbCloudDb/Migrations/20210907085527_Init.Designer.cs
@@ -0,0 +1,2010 @@
+//
+using System;
+using System.Collections.Generic;
+using AsbCloudDb.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace AsbCloudDb.Migrations
+{
+ [DbContext(typeof(AsbCloudDbContext))]
+ [Migration("20210907085527_Init")]
+ partial class Init
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasPostgresExtension("adminpack")
+ .UseIdentityByDefaultColumns()
+ .HasAnnotation("Relational:Collation", "Russian_Russia.1251")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63)
+ .HasAnnotation("ProductVersion", "5.0.2");
+
+ modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption")
+ .HasComment("Название");
+
+ b.Property("IdDeposit")
+ .HasColumnType("integer")
+ .HasColumnName("id_deposit");
+
+ b.Property("Latitude")
+ .HasColumnType("double precision")
+ .HasColumnName("latitude");
+
+ b.Property("Longitude")
+ .HasColumnType("double precision")
+ .HasColumnName("longitude");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdDeposit");
+
+ b.ToTable("t_cluster");
+
+ b
+ .HasComment("Кусты");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Company", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption");
+
+ b.Property("IdCompanyType")
+ .HasMaxLength(255)
+ .HasColumnType("integer")
+ .HasColumnName("id_company_type")
+ .HasComment("вид деятельности");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdCompanyType");
+
+ b.ToTable("t_company");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Caption = "ООО \"АСБ\"",
+ IdCompanyType = 3
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_company_type");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Caption = "Недрапользователь"
+ },
+ new
+ {
+ Id = 2,
+ Caption = "Буровой подрядчик"
+ },
+ new
+ {
+ Id = 3,
+ Caption = "Сервис автоматизации бурения"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.DataSaubBase", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("AxialLoad")
+ .HasColumnType("double precision")
+ .HasColumnName("axial_load")
+ .HasComment("Осевая нагрузка");
+
+ b.Property("AxialLoadLimitMax")
+ .HasColumnType("double precision")
+ .HasColumnName("axial_load_limit_max")
+ .HasComment("Осевая нагрузка. Аварийная макс.");
+
+ b.Property("AxialLoadSp")
+ .HasColumnType("double precision")
+ .HasColumnName("axial_load_sp")
+ .HasComment("Осевая нагрузка. Задание");
+
+ b.Property("BitDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("bit_depth")
+ .HasComment("Положение инструмента");
+
+ b.Property("BlockPosition")
+ .HasColumnType("double precision")
+ .HasColumnName("block_position")
+ .HasComment("Высота талевого блока");
+
+ b.Property("BlockPositionMax")
+ .HasColumnType("double precision")
+ .HasColumnName("block_position_max")
+ .HasComment("Талевый блок. Макс положение");
+
+ b.Property("BlockPositionMin")
+ .HasColumnType("double precision")
+ .HasColumnName("block_position_min")
+ .HasComment("Талевый блок. Мин положение");
+
+ b.Property("BlockSpeed")
+ .HasColumnType("double precision")
+ .HasColumnName("block_speed")
+ .HasComment("Скорость талевого блока");
+
+ b.Property("BlockSpeedSp")
+ .HasColumnType("double precision")
+ .HasColumnName("block_speed_sp")
+ .HasComment("Скорости талевого блока. Задание");
+
+ b.Property("BlockSpeedSpDevelop")
+ .HasColumnType("double precision")
+ .HasColumnName("block_speed_sp_develop")
+ .HasComment("Талевый блок. Задание скорости для проработки");
+
+ b.Property("BlockSpeedSpRotor")
+ .HasColumnType("double precision")
+ .HasColumnName("block_speed_sp_rotor")
+ .HasComment("Талевый блок. Задание скорости для роторного бурения");
+
+ b.Property("BlockSpeedSpSlide")
+ .HasColumnType("double precision")
+ .HasColumnName("block_speed_sp_slide")
+ .HasComment("Талевый блок. Задание скорости для режима слайда");
+
+ b.Property("Date")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date")
+ .HasComment("'2021-10-19 18:23:54+05'");
+
+ b.Property("Flow")
+ .HasColumnType("double precision")
+ .HasColumnName("flow")
+ .HasComment("Расход");
+
+ b.Property("FlowDeltaLimitMax")
+ .HasColumnType("double precision")
+ .HasColumnName("flow_delta_limit_max")
+ .HasComment("Расход. Аварийный макс.");
+
+ b.Property("FlowIdle")
+ .HasColumnType("double precision")
+ .HasColumnName("flow_idle")
+ .HasComment("Расход. Холостой ход");
+
+ b.Property("HookWeight")
+ .HasColumnType("double precision")
+ .HasColumnName("hook_weight")
+ .HasComment("Вес на крюке");
+
+ b.Property("HookWeightIdle")
+ .HasColumnType("double precision")
+ .HasColumnName("hook_weight_idle")
+ .HasComment("Вес на крюке. Холостой ход");
+
+ b.Property("HookWeightLimitMax")
+ .HasColumnType("double precision")
+ .HasColumnName("hook_weight_limit_max")
+ .HasComment("Вес на крюке. Затяжка");
+
+ b.Property("HookWeightLimitMin")
+ .HasColumnType("double precision")
+ .HasColumnName("hook_weight_limit_min")
+ .HasComment("Вес на крюке. Посадка");
+
+ b.Property("IdFeedRegulator")
+ .HasColumnType("double precision")
+ .HasColumnName("id_feed_regulator")
+ .HasComment("Текущий критерий бурения");
+
+ b.Property("IdTelemetry")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry");
+
+ b.Property("IdUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_user")
+ .HasComment("Пользователь САУБ");
+
+ b.Property("Mode")
+ .HasColumnType("integer")
+ .HasColumnName("mode")
+ .HasComment("Режим САУБ");
+
+ b.Property("MseState")
+ .HasColumnType("double precision")
+ .HasColumnName("mse_state")
+ .HasComment("Текущее состояние работы MSE");
+
+ b.Property("Pressure")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure")
+ .HasComment("Давление");
+
+ b.Property("PressureDeltaLimitMax")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure_delta_limit_max")
+ .HasComment("Давление дифф. Аварийное макс.");
+
+ b.Property("PressureIdle")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure_idle")
+ .HasComment("Давление. Холостой ход");
+
+ b.Property("PressureSp")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure_sp")
+ .HasComment("Давление. Задание");
+
+ b.Property("PressureSpDevelop")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure_sp_develop")
+ .HasComment("Давление. Задание для проработки");
+
+ b.Property("PressureSpRotor")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure_sp_rotor")
+ .HasComment("Давление. Задание для роторного бурения");
+
+ b.Property("PressureSpSlide")
+ .HasColumnType("double precision")
+ .HasColumnName("pressure_sp_slide")
+ .HasComment("Давление. Задание для режима слайда");
+
+ b.Property("RotorSpeed")
+ .HasColumnType("double precision")
+ .HasColumnName("rotor_speed")
+ .HasComment("Обороты ротора");
+
+ b.Property("RotorTorque")
+ .HasColumnType("double precision")
+ .HasColumnName("rotor_torque")
+ .HasComment("Момент на роторе");
+
+ b.Property("RotorTorqueIdle")
+ .HasColumnType("double precision")
+ .HasColumnName("rotor_torque_idle")
+ .HasComment("Момент на роторе. Холостой ход");
+
+ b.Property("RotorTorqueLimitMax")
+ .HasColumnType("double precision")
+ .HasColumnName("rotor_torque_limit_max")
+ .HasComment("Момент на роторе. Аварийный макс.");
+
+ b.Property("RotorTorqueSp")
+ .HasColumnType("double precision")
+ .HasColumnName("rotor_torque_sp")
+ .HasComment("Момент на роторе. Задание");
+
+ b.Property("WellDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("well_depth")
+ .HasComment("Глубина забоя");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdTelemetry");
+
+ b.ToTable("t_data_saub_base");
+
+ b
+ .HasComment("набор основных данных по SAUB");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption");
+
+ b.Property("Latitude")
+ .HasColumnType("double precision")
+ .HasColumnName("latitude");
+
+ b.Property("Longitude")
+ .HasColumnType("double precision")
+ .HasColumnName("longitude");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_deposit");
+
+ b
+ .HasComment("Месторождение");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Name")
+ .HasColumnType("text")
+ .HasColumnName("name")
+ .HasComment("Название категории");
+
+ b.Property("ShortName")
+ .HasColumnType("text")
+ .HasColumnName("short_name")
+ .HasComment("Короткое название категории");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_file_category");
+
+ b
+ .HasComment("Категории файлов");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Name = "Растворный сервис",
+ ShortName = "fluidService"
+ },
+ new
+ {
+ Id = 2,
+ Name = "Цементирование",
+ ShortName = "cement"
+ },
+ new
+ {
+ Id = 3,
+ Name = "ННБ",
+ ShortName = "nnb"
+ },
+ new
+ {
+ Id = 4,
+ Name = "ГТИ",
+ ShortName = "gti"
+ },
+ new
+ {
+ Id = 5,
+ Name = "Документы по скважине",
+ ShortName = "wellDocuments"
+ },
+ new
+ {
+ Id = 6,
+ Name = "Супервайзер",
+ ShortName = "supervisor"
+ },
+ new
+ {
+ Id = 7,
+ Name = "Мастер",
+ ShortName = "master"
+ },
+ new
+ {
+ Id = 8,
+ Name = "Последний замер бурового раствора ПЛАН",
+ ShortName = "fluidPlanLastData"
+ },
+ new
+ {
+ Id = 9,
+ Name = "Последний замер бурового раствора ФАКТ",
+ ShortName = "fluidFactLastData"
+ },
+ new
+ {
+ Id = 10,
+ Name = "Последние данные Шламограммы",
+ ShortName = "mudLastData"
+ },
+ new
+ {
+ Id = 11,
+ Name = "Последние данные ННБ",
+ ShortName = "nnbLastData"
+ },
+ new
+ {
+ Id = 12,
+ Name = "Рапорт",
+ ShortName = "report"
+ },
+ new
+ {
+ Id = 13,
+ Name = "Программа бурения, части",
+ ShortName = "ПБч"
+ },
+ new
+ {
+ Id = 14,
+ Name = "Программа бурения",
+ ShortName = "ПБ"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("IdAuthor")
+ .HasColumnType("integer")
+ .HasColumnName("id_author")
+ .HasComment("Id пользователя, загрузившего файл");
+
+ b.Property("IdCategory")
+ .HasColumnType("integer")
+ .HasColumnName("id_category")
+ .HasComment("id категории файла");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("id скважины");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean")
+ .HasColumnName("is_deleted")
+ .HasComment("Удален ли файл");
+
+ b.Property("Name")
+ .HasColumnType("text")
+ .HasColumnName("name")
+ .HasComment("Название файла");
+
+ b.Property("Size")
+ .HasColumnType("bigint")
+ .HasColumnName("file_size")
+ .HasComment("Размер файла");
+
+ b.Property("UploadDate")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdAuthor");
+
+ b.HasIndex("IdCategory");
+
+ b.HasIndex("IdWell");
+
+ b.ToTable("t_file_info");
+
+ b
+ .HasComment("Файлы всех категорий");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Measure", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property>("Data")
+ .HasColumnType("jsonb")
+ .HasColumnName("data")
+ .HasComment("Данные таблицы последних данных");
+
+ b.Property("IdCategory")
+ .HasColumnType("integer")
+ .HasColumnName("id_category")
+ .HasComment("id категории");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("id скважины");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean")
+ .HasColumnName("is_deleted")
+ .HasComment("Пометка удаленным");
+
+ b.Property("Timestamp")
+ .HasColumnType("timestamp without time zone")
+ .HasColumnName("timestamp")
+ .HasComment("время добавления");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdCategory");
+
+ b.HasIndex("IdWell");
+
+ b.ToTable("t_measure");
+
+ b
+ .HasComment("Таблица c данными для вкладки 'Последние данные'");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Name")
+ .HasColumnType("text")
+ .HasColumnName("name")
+ .HasComment("Название категории");
+
+ b.Property("ShortName")
+ .HasColumnType("text")
+ .HasColumnName("short_name")
+ .HasComment("Короткое название категории");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_measure_category");
+
+ b
+ .HasComment("Категория последних данных");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Name = "Показатели бурового раствора",
+ ShortName = "Раствор"
+ },
+ new
+ {
+ Id = 2,
+ Name = "Шламограмма",
+ ShortName = "Шламограмма"
+ },
+ new
+ {
+ Id = 3,
+ Name = "ННБ",
+ ShortName = "ННБ"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
+ {
+ b.Property("IdCompany")
+ .HasColumnType("integer")
+ .HasColumnName("id_company");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well");
+
+ b.HasKey("IdCompany", "IdWell");
+
+ b.HasIndex("IdWell");
+
+ b.ToTable("t_relation_company_well");
+
+ b
+ .HasComment("отношение скважин и компаний");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Begin")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("begin");
+
+ b.Property("End")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("end")
+ .HasComment("timestamp with time zone");
+
+ b.Property("Format")
+ .HasColumnType("integer")
+ .HasColumnName("format")
+ .HasComment("Формат отчета");
+
+ b.Property("IdFile")
+ .HasColumnType("integer")
+ .HasColumnName("id_file")
+ .HasComment("id файла-родителя");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("id скважины");
+
+ b.Property("Step")
+ .HasColumnType("integer")
+ .HasColumnName("step")
+ .HasComment("размер шага в секундах");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdFile");
+
+ b.HasIndex("IdWell");
+
+ b.ToTable("t_report_property");
+
+ b
+ .HasComment("Отчеты с данными по буровым");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Info")
+ .HasColumnType("jsonb")
+ .HasColumnName("info")
+ .HasComment("Информация с панели о скважине");
+
+ b.Property("RemoteUid")
+ .HasColumnType("text")
+ .HasColumnName("remote_uid")
+ .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв.");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index");
+
+ b.ToTable("t_telemetry");
+
+ b
+ .HasComment("таблица привязки телеметрии от комплектов к конкретной скважине.");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryAnalysis", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("DurationSec")
+ .HasColumnType("integer")
+ .HasColumnName("duration_sec")
+ .HasComment("Кол-во секунд после предыдущей операции");
+
+ b.Property("IdOperation")
+ .HasColumnType("integer")
+ .HasColumnName("id_operation");
+
+ b.Property("IdTelemetry")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry");
+
+ b.Property("IsBitPositionDecreasing")
+ .HasColumnType("boolean")
+ .HasColumnName("is_bit_position_decreasing")
+ .HasComment("Долото поднимается");
+
+ b.Property("IsBitPositionIncreasing")
+ .HasColumnType("boolean")
+ .HasColumnName("is_bit_position_increasing")
+ .HasComment("Долото спускается");
+
+ b.Property("IsBitPositionLt20")
+ .HasColumnType("boolean")
+ .HasColumnName("is_bit_posision_lt_20")
+ .HasComment("Положение долота меньше 20м");
+
+ b.Property("IsBlockPositionDecreasing")
+ .HasColumnType("boolean")
+ .HasColumnName("is_block_posision_decresing")
+ .HasComment("Талевый блок поднимается");
+
+ b.Property("IsBlockPositionIncreasing")
+ .HasColumnType("boolean")
+ .HasColumnName("is_block_posision_incresing")
+ .HasComment("Талевый блок спускается");
+
+ b.Property("IsHookWeightLt3")
+ .HasColumnType("boolean")
+ .HasColumnName("is_hook_weight_lt_3")
+ .HasComment("Вес на крюке менее 3т");
+
+ b.Property("IsHookWeightNotChanges")
+ .HasColumnType("boolean")
+ .HasColumnName("is_hook_weight_not_changes")
+ .HasComment("Вес на крюке не меняется");
+
+ b.Property("IsPressureGt20")
+ .HasColumnType("boolean")
+ .HasColumnName("is_pressure_gt_20")
+ .HasComment("Давоение более 20");
+
+ b.Property("IsPressureLt20")
+ .HasColumnType("boolean")
+ .HasColumnName("is_pressure_lt_20")
+ .HasComment("Давление менее 20");
+
+ b.Property("IsRotorSpeedGt3")
+ .HasColumnType("boolean")
+ .HasColumnName("is_rotor_speed_gt_3")
+ .HasComment("Обороты ротора выше 3");
+
+ b.Property("IsRotorSpeedLt3")
+ .HasColumnType("boolean")
+ .HasColumnName("is_rotor_speed_lt_3")
+ .HasComment("Обороты ротора ниже 3");
+
+ b.Property("IsWellDepthDecreasing")
+ .HasColumnType("boolean")
+ .HasColumnName("is_well_depth_decreasing")
+ .HasComment("Глубина забоя не увеличивается");
+
+ b.Property("IsWellDepthIncreasing")
+ .HasColumnType("boolean")
+ .HasColumnName("is_well_depth_increasing")
+ .HasComment("Глубина забоя увеличивается");
+
+ b.Property("OperationEndDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("operation_end_depth")
+ .HasComment("Глубина, на которой закончилась операция");
+
+ b.Property("OperationStartDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("operation_start_depth")
+ .HasComment("Глубина, на которой началась операция");
+
+ b.Property("UnixDate")
+ .HasColumnType("bigint")
+ .HasColumnName("unix_date")
+ .HasComment("Unix timestamp для Linq запросов с вычислением дат");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdOperation");
+
+ b.HasIndex("IdTelemetry");
+
+ b.ToTable("t_telemetry_analysis");
+
+ b
+ .HasComment("События на скважине");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b =>
+ {
+ b.Property("IdTelemetry")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry");
+
+ b.Property("IdEvent")
+ .HasColumnType("integer")
+ .HasColumnName("id_event");
+
+ b.Property("IdCategory")
+ .HasColumnType("integer")
+ .HasColumnName("id_category");
+
+ b.Property("MessageTemplate")
+ .HasColumnType("text")
+ .HasColumnName("message_template");
+
+ b.HasKey("IdTelemetry", "IdEvent");
+
+ b.ToTable("t_telemetry_event");
+
+ b
+ .HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Arg0")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("arg0")
+ .HasComment("Аргумент №0 для вставки в шаблон сообщения");
+
+ b.Property("Arg1")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("arg1");
+
+ b.Property("Arg2")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("arg2");
+
+ b.Property("Arg3")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("arg3");
+
+ b.Property("Date")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date");
+
+ b.Property("IdEvent")
+ .HasColumnType("integer")
+ .HasColumnName("id_event");
+
+ b.Property("IdTelemetry")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry");
+
+ b.Property("IdTelemetryUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry_user")
+ .HasComment("Пользователь панели отправляющей телеметрию. не пользователь облака.");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdTelemetry");
+
+ b.ToTable("t_telemetry_message");
+
+ b
+ .HasComment("Сообщения на буровых");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b =>
+ {
+ b.Property("IdTelemetry")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry");
+
+ b.Property("IdUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_user");
+
+ b.Property("Level")
+ .HasColumnType("integer")
+ .HasColumnName("level");
+
+ b.Property("Name")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("name");
+
+ b.Property("Patronymic")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("patronymic");
+
+ b.Property("Surname")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("surname");
+
+ b.HasKey("IdTelemetry", "IdUser");
+
+ b.ToTable("t_telemetry_user");
+
+ b
+ .HasComment("Пользователи панели САУБ. Для сообщений.");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("IdCompany")
+ .HasColumnType("integer")
+ .HasColumnName("id_company");
+
+ b.Property("IdRole")
+ .HasColumnType("integer")
+ .HasColumnName("id_role");
+
+ b.Property("Level")
+ .HasColumnType("integer")
+ .HasColumnName("level");
+
+ b.Property("Login")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("login");
+
+ b.Property("Name")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("name")
+ .HasComment("имя");
+
+ b.Property("PasswordHash")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("password_hash")
+ .HasComment("соленый хэш пароля.\nпервые 5 символов - соль");
+
+ b.Property("Patronymic")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("patronymic")
+ .HasComment("отчество");
+
+ b.Property("State")
+ .HasColumnType("smallint")
+ .HasColumnName("state")
+ .HasComment("состояние:\n100 - удален");
+
+ b.Property("Surname")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("surname")
+ .HasComment("фамилия");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdCompany");
+
+ b.HasIndex("IdRole");
+
+ b.HasIndex("Login")
+ .IsUnique();
+
+ b.ToTable("t_user");
+
+ b
+ .HasComment("Пользователи облака");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ IdCompany = 1,
+ IdRole = 1,
+ Level = 2147483647,
+ Login = "dev",
+ Name = "Разработчик",
+ PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.UserRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption")
+ .HasComment("Название");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_user_role");
+
+ b
+ .HasComment("Роли пользователей в системе");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Caption = "Администратор"
+ },
+ new
+ {
+ Id = 2,
+ Caption = "Пользователь"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption");
+
+ b.Property("IdCluster")
+ .HasColumnType("integer")
+ .HasColumnName("id_cluster");
+
+ b.Property("IdTelemetry")
+ .HasColumnType("integer")
+ .HasColumnName("id_telemetry");
+
+ b.Property("IdWellType")
+ .HasColumnType("integer")
+ .HasColumnName("id_well_type");
+
+ b.Property("Latitude")
+ .HasColumnType("double precision")
+ .HasColumnName("latitude");
+
+ b.Property("Longitude")
+ .HasColumnType("double precision")
+ .HasColumnName("longitude");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdCluster");
+
+ b.HasIndex("IdTelemetry")
+ .IsUnique();
+
+ b.HasIndex("IdWellType");
+
+ b.ToTable("t_well");
+
+ b
+ .HasComment("скважины");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("CategoryInfo")
+ .HasColumnType("text")
+ .HasColumnName("category_info")
+ .HasComment("Доп. информация к выбраной категории");
+
+ b.Property("Comment")
+ .HasColumnType("text")
+ .HasColumnName("comment")
+ .HasComment("Комментарий");
+
+ b.Property("DurationHours")
+ .HasColumnType("double precision")
+ .HasColumnName("duration_hours")
+ .HasComment("Продолжительность в часах");
+
+ b.Property("IdCategory")
+ .HasColumnType("integer")
+ .HasColumnName("id_category")
+ .HasComment("Id категории операции");
+
+ b.Property("IdType")
+ .HasColumnType("integer")
+ .HasColumnName("id_type")
+ .HasComment("0 = План или 1 = Факт");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("Id скважины");
+
+ b.Property("IdWellSectionType")
+ .HasColumnType("integer")
+ .HasColumnName("id_well_section_type")
+ .HasComment("Id тип секции скважины");
+
+ b.Property("StartDate")
+ .HasColumnType("timestamp without time zone")
+ .HasColumnName("date")
+ .HasComment("Дата начала операции");
+
+ b.Property("WellDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("depth")
+ .HasComment("Глубина, на которой производилась операция");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdCategory");
+
+ b.HasIndex("IdWell");
+
+ b.HasIndex("IdWellSectionType");
+
+ b.HasIndex("StartDate");
+
+ b.HasIndex("WellDepth");
+
+ b.ToTable("t_well_operation");
+
+ b
+ .HasComment("Данные по операциям на скважине");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Code")
+ .HasColumnType("integer")
+ .HasColumnName("code")
+ .HasComment("Код операции");
+
+ b.Property("Name")
+ .HasColumnType("text")
+ .HasColumnName("name")
+ .HasComment("Название категории операции");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_well_operation_category");
+
+ b
+ .HasComment("Справочник операций на скважине");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Code = 0,
+ Name = "Невозможно определить операцию"
+ },
+ new
+ {
+ Id = 2,
+ Code = 0,
+ Name = "Роторное бурение"
+ },
+ new
+ {
+ Id = 3,
+ Code = 0,
+ Name = "Слайдирование"
+ },
+ new
+ {
+ Id = 4,
+ Code = 0,
+ Name = "Подъем с проработкой"
+ },
+ new
+ {
+ Id = 5,
+ Code = 0,
+ Name = "Спуск с проработкой"
+ },
+ new
+ {
+ Id = 6,
+ Code = 0,
+ Name = "Подъем с промывкой"
+ },
+ new
+ {
+ Id = 7,
+ Code = 0,
+ Name = "Спуск с промывкой"
+ },
+ new
+ {
+ Id = 8,
+ Code = 0,
+ Name = "Спуск в скважину"
+ },
+ new
+ {
+ Id = 9,
+ Code = 0,
+ Name = "Спуск с вращением"
+ },
+ new
+ {
+ Id = 10,
+ Code = 0,
+ Name = "Подъем из скважины"
+ },
+ new
+ {
+ Id = 11,
+ Code = 0,
+ Name = "Подъем с вращением"
+ },
+ new
+ {
+ Id = 12,
+ Code = 0,
+ Name = "Промывка в покое"
+ },
+ new
+ {
+ Id = 13,
+ Code = 0,
+ Name = "Промывка с вращением"
+ },
+ new
+ {
+ Id = 14,
+ Code = 0,
+ Name = "Удержание в клиньях"
+ },
+ new
+ {
+ Id = 15,
+ Code = 0,
+ Name = "Неподвижное состояние"
+ },
+ new
+ {
+ Id = 16,
+ Code = 0,
+ Name = "Вращение без циркуляции"
+ },
+ new
+ {
+ Id = 17,
+ Code = 0,
+ Name = "На поверхности"
+ },
+ new
+ {
+ Id = 1001,
+ Code = 0,
+ Name = "Бурение в интервале"
+ },
+ new
+ {
+ Id = 1002,
+ Code = 0,
+ Name = "ГИС"
+ },
+ new
+ {
+ Id = 1003,
+ Code = 0,
+ Name = "ГФР"
+ },
+ new
+ {
+ Id = 1004,
+ Code = 0,
+ Name = "Монтаж ПВО"
+ },
+ new
+ {
+ Id = 1005,
+ Code = 0,
+ Name = "Демонтаж ПВО"
+ },
+ new
+ {
+ Id = 1006,
+ Code = 0,
+ Name = "Установка ФА"
+ },
+ new
+ {
+ Id = 1007,
+ Code = 0,
+ Name = "Оборудование устья"
+ },
+ new
+ {
+ Id = 1008,
+ Code = 0,
+ Name = "ОЗЦ"
+ },
+ new
+ {
+ Id = 1009,
+ Code = 0,
+ Name = "Оборудование устья"
+ },
+ new
+ {
+ Id = 1010,
+ Code = 0,
+ Name = "ОЗЦ"
+ },
+ new
+ {
+ Id = 1011,
+ Code = 0,
+ Name = "Начало цикла строительства скважины"
+ },
+ new
+ {
+ Id = 1012,
+ Code = 0,
+ Name = "Окончание цикла строительства скважины"
+ },
+ new
+ {
+ Id = 1013,
+ Code = 0,
+ Name = "Опрессовка ПВО"
+ },
+ new
+ {
+ Id = 1014,
+ Code = 0,
+ Name = "Опресовка Ц.К."
+ },
+ new
+ {
+ Id = 1015,
+ Code = 0,
+ Name = "Опрессовка ВЗД"
+ },
+ new
+ {
+ Id = 1016,
+ Code = 0,
+ Name = "Перевод скв на другой тип промывочной жидкости"
+ },
+ new
+ {
+ Id = 1017,
+ Code = 0,
+ Name = "Перезапись каротажа"
+ },
+ new
+ {
+ Id = 1018,
+ Code = 0,
+ Name = "Перетяжка талевого каната"
+ },
+ new
+ {
+ Id = 1019,
+ Code = 0,
+ Name = "Перетяжка тальканата"
+ },
+ new
+ {
+ Id = 1020,
+ Code = 0,
+ Name = "Подъем инструмента"
+ },
+ new
+ {
+ Id = 1021,
+ Code = 0,
+ Name = "Подъем инструмента с промывкой"
+ },
+ new
+ {
+ Id = 1022,
+ Code = 0,
+ Name = "Обратная проработка"
+ },
+ new
+ {
+ Id = 1023,
+ Code = 0,
+ Name = "Сборка инструмента"
+ },
+ new
+ {
+ Id = 1024,
+ Code = 0,
+ Name = "Подготовительные работы"
+ },
+ new
+ {
+ Id = 1025,
+ Code = 0,
+ Name = "Сборка КНБК"
+ },
+ new
+ {
+ Id = 1026,
+ Code = 0,
+ Name = "Разборка КНБК"
+ },
+ new
+ {
+ Id = 1027,
+ Code = 0,
+ Name = "Промывка"
+ },
+ new
+ {
+ Id = 1028,
+ Code = 0,
+ Name = "Промежуточная промывка"
+ },
+ new
+ {
+ Id = 1029,
+ Code = 0,
+ Name = "Прокачка пачек"
+ },
+ new
+ {
+ Id = 1030,
+ Code = 0,
+ Name = "Разбуривание тех.оснастки"
+ },
+ new
+ {
+ Id = 1031,
+ Code = 0,
+ Name = "Ремонт"
+ },
+ new
+ {
+ Id = 1032,
+ Code = 0,
+ Name = "Спуск инструмента"
+ },
+ new
+ {
+ Id = 1033,
+ Code = 0,
+ Name = "Спуск инструмента с промывкой"
+ },
+ new
+ {
+ Id = 1034,
+ Code = 0,
+ Name = "Прямая проработка"
+ },
+ new
+ {
+ Id = 1035,
+ Code = 0,
+ Name = "Принудительная проработка"
+ },
+ new
+ {
+ Id = 1036,
+ Code = 0,
+ Name = "Спуск обсадной колонны"
+ },
+ new
+ {
+ Id = 1037,
+ Code = 0,
+ Name = "Тех СПО-подъем"
+ },
+ new
+ {
+ Id = 1038,
+ Code = 0,
+ Name = "Тех СПО-спуск"
+ },
+ new
+ {
+ Id = 1039,
+ Code = 0,
+ Name = "Техническое обслуживание"
+ },
+ new
+ {
+ Id = 1040,
+ Code = 0,
+ Name = "Цементаж"
+ },
+ new
+ {
+ Id = 1041,
+ Code = 0,
+ Name = "Шаблонировка ствола"
+ },
+ new
+ {
+ Id = 1042,
+ Code = 0,
+ Name = "Геологическое осложнение"
+ },
+ new
+ {
+ Id = 1043,
+ Code = 0,
+ Name = "НПВ"
+ },
+ new
+ {
+ Id = 1044,
+ Code = 0,
+ Name = "ВМР"
+ },
+ new
+ {
+ Id = 1045,
+ Code = 0,
+ Name = "Прочее"
+ },
+ new
+ {
+ Id = 1046,
+ Code = 0,
+ Name = "Спуск КНБК"
+ },
+ new
+ {
+ Id = 1047,
+ Code = 0,
+ Name = "Подъем КНБК"
+ },
+ new
+ {
+ Id = 1048,
+ Code = 0,
+ Name = "Спуск ОК"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption")
+ .HasComment("Название");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_well_section_type");
+
+ b
+ .HasComment("конструкция секции скважины");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Caption = "Пилотный ствол"
+ },
+ new
+ {
+ Id = 2,
+ Caption = "Направление"
+ },
+ new
+ {
+ Id = 3,
+ Caption = "Кондуктор"
+ },
+ new
+ {
+ Id = 4,
+ Caption = "Эксплуатационная колонна"
+ },
+ new
+ {
+ Id = 5,
+ Caption = "Транспортный ствол"
+ },
+ new
+ {
+ Id = 6,
+ Caption = "Хвостовик"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id")
+ .UseIdentityByDefaultColumn();
+
+ b.Property("Caption")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("caption")
+ .HasComment("Название");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_well_type");
+
+ b
+ .HasComment("конструкция скважины");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ Caption = "Наклонно-направленная"
+ },
+ new
+ {
+ Id = 2,
+ Caption = "Горизонтальная"
+ });
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Deposit", "Deposit")
+ .WithMany("Clusters")
+ .HasForeignKey("IdDeposit")
+ .HasConstraintName("t_cluster_t_deposit_id_fk");
+
+ b.Navigation("Deposit");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Company", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType")
+ .WithMany("Companies")
+ .HasForeignKey("IdCompanyType")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CompanyType");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.DataSaubBase", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
+ .WithMany("DataSaubBases")
+ .HasForeignKey("IdTelemetry")
+ .HasConstraintName("t_data_saub_base_t_telemetry_id_fk")
+ .IsRequired();
+
+ b.Navigation("Telemetry");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.User", "Author")
+ .WithMany("Files")
+ .HasForeignKey("IdAuthor");
+
+ b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory")
+ .WithMany()
+ .HasForeignKey("IdCategory")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany()
+ .HasForeignKey("IdWell")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Author");
+
+ b.Navigation("FileCategory");
+
+ b.Navigation("Well");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Measure", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category")
+ .WithMany("Measures")
+ .HasForeignKey("IdCategory")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany()
+ .HasForeignKey("IdWell")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Category");
+
+ b.Navigation("Well");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Company", "Company")
+ .WithMany("RelationCompaniesWells")
+ .HasForeignKey("IdCompany")
+ .HasConstraintName("t_relation_company_well_t_company_id_fk")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany("RelationCompaniesWells")
+ .HasForeignKey("IdWell")
+ .HasConstraintName("t_relation_company_well_t_well_id_fk")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Company");
+
+ b.Navigation("Well");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.FileInfo", "File")
+ .WithMany()
+ .HasForeignKey("IdFile")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany()
+ .HasForeignKey("IdWell")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("File");
+
+ b.Navigation("Well");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryAnalysis", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Operation")
+ .WithMany("Analysis")
+ .HasForeignKey("IdOperation")
+ .HasConstraintName("t_analysis_t_operation_id_fk")
+ .OnDelete(DeleteBehavior.SetNull)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
+ .WithMany("Analysis")
+ .HasForeignKey("IdTelemetry")
+ .HasConstraintName("t_analysis_t_telemetry_id_fk")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Operation");
+
+ b.Navigation("Telemetry");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
+ .WithMany("Events")
+ .HasForeignKey("IdTelemetry")
+ .HasConstraintName("t_event_t_telemetry_id_fk")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Telemetry");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
+ .WithMany("Messages")
+ .HasForeignKey("IdTelemetry")
+ .HasConstraintName("t_messages_t_telemetry_id_fk")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Telemetry");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
+ .WithMany("Users")
+ .HasForeignKey("IdTelemetry")
+ .HasConstraintName("t_telemetry_user_t_telemetry_id_fk")
+ .IsRequired();
+
+ b.Navigation("Telemetry");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.User", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Company", "Company")
+ .WithMany("Users")
+ .HasForeignKey("IdCompany")
+ .HasConstraintName("t_user_t_company_id_fk");
+
+ b.HasOne("AsbCloudDb.Model.UserRole", "Role")
+ .WithMany("Users")
+ .HasForeignKey("IdRole");
+
+ b.Navigation("Company");
+
+ b.Navigation("Role");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.Cluster", "Cluster")
+ .WithMany("Wells")
+ .HasForeignKey("IdCluster")
+ .HasConstraintName("t_well_t_cluster_id_fk");
+
+ b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
+ .WithOne("Well")
+ .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry")
+ .HasConstraintName("t_well_t_telemetry_id_fk");
+
+ b.HasOne("AsbCloudDb.Model.WellType", "WellType")
+ .WithMany("Wells")
+ .HasForeignKey("IdWellType");
+
+ b.Navigation("Cluster");
+
+ b.Navigation("Telemetry");
+
+ b.Navigation("WellType");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory")
+ .WithMany()
+ .HasForeignKey("IdCategory")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany("WellOperations")
+ .HasForeignKey("IdWell")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
+ .WithMany("WellOperations")
+ .HasForeignKey("IdWellSectionType")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("OperationCategory");
+
+ b.Navigation("Well");
+
+ b.Navigation("WellSectionType");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
+ {
+ b.Navigation("Wells");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Company", b =>
+ {
+ b.Navigation("RelationCompaniesWells");
+
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b =>
+ {
+ b.Navigation("Companies");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
+ {
+ b.Navigation("Clusters");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b =>
+ {
+ b.Navigation("Measures");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b =>
+ {
+ b.Navigation("Analysis");
+
+ b.Navigation("DataSaubBases");
+
+ b.Navigation("Events");
+
+ b.Navigation("Messages");
+
+ b.Navigation("Users");
+
+ b.Navigation("Well");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.User", b =>
+ {
+ b.Navigation("Files");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.UserRole", b =>
+ {
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
+ {
+ b.Navigation("RelationCompaniesWells");
+
+ b.Navigation("WellOperations");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b =>
+ {
+ b.Navigation("Analysis");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b =>
+ {
+ b.Navigation("WellOperations");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.WellType", b =>
+ {
+ b.Navigation("Wells");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/AsbCloudDb/Migrations/20210907085527_Init.cs b/AsbCloudDb/Migrations/20210907085527_Init.cs
new file mode 100644
index 00000000..8ef9032b
--- /dev/null
+++ b/AsbCloudDb/Migrations/20210907085527_Init.cs
@@ -0,0 +1,956 @@
+using System;
+using System.Collections.Generic;
+using AsbCloudDb.Model;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace AsbCloudDb.Migrations
+{
+ 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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ latitude = table.Column(type: "double precision", nullable: true),
+ longitude = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ name = table.Column(type: "text", nullable: true, comment: "Название категории"),
+ short_name = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ name = table.Column(type: "text", nullable: true, comment: "Название категории"),
+ short_name = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ remote_uid = table.Column(type: "text", nullable: true, comment: "Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."),
+ info = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ name = table.Column(type: "text", nullable: true, comment: "Название категории операции"),
+ code = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ id_company_type = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ caption = table.Column(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название"),
+ id_deposit = table.Column(type: "integer", nullable: true),
+ latitude = table.Column(type: "double precision", nullable: true),
+ longitude = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ id_telemetry = table.Column(type: "integer", nullable: false),
+ date = table.Column(type: "timestamp with time zone", nullable: false, comment: "'2021-10-19 18:23:54+05'"),
+ mode = table.Column(type: "integer", nullable: true, comment: "Режим САУБ"),
+ id_user = table.Column(type: "integer", nullable: true, comment: "Пользователь САУБ"),
+ well_depth = table.Column(type: "double precision", nullable: true, comment: "Глубина забоя"),
+ bit_depth = table.Column(type: "double precision", nullable: true, comment: "Положение инструмента"),
+ block_position = table.Column(type: "double precision", nullable: true, comment: "Высота талевого блока"),
+ block_position_min = table.Column(type: "double precision", nullable: true, comment: "Талевый блок. Мин положение"),
+ block_position_max = table.Column(type: "double precision", nullable: true, comment: "Талевый блок. Макс положение"),
+ block_speed = table.Column(type: "double precision", nullable: true, comment: "Скорость талевого блока"),
+ block_speed_sp = table.Column(type: "double precision", nullable: true, comment: "Скорости талевого блока. Задание"),
+ block_speed_sp_rotor = table.Column(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для роторного бурения"),
+ block_speed_sp_slide = table.Column(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для режима слайда"),
+ block_speed_sp_develop = table.Column(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для проработки"),
+ pressure = table.Column(type: "double precision", nullable: true, comment: "Давление"),
+ pressure_idle = table.Column(type: "double precision", nullable: true, comment: "Давление. Холостой ход"),
+ pressure_sp = table.Column(type: "double precision", nullable: true, comment: "Давление. Задание"),
+ pressure_sp_rotor = table.Column(type: "double precision", nullable: true, comment: "Давление. Задание для роторного бурения"),
+ pressure_sp_slide = table.Column(type: "double precision", nullable: true, comment: "Давление. Задание для режима слайда"),
+ pressure_sp_develop = table.Column(type: "double precision", nullable: true, comment: "Давление. Задание для проработки"),
+ pressure_delta_limit_max = table.Column(type: "double precision", nullable: true, comment: "Давление дифф. Аварийное макс."),
+ axial_load = table.Column(type: "double precision", nullable: true, comment: "Осевая нагрузка"),
+ axial_load_sp = table.Column(type: "double precision", nullable: true, comment: "Осевая нагрузка. Задание"),
+ axial_load_limit_max = table.Column(type: "double precision", nullable: true, comment: "Осевая нагрузка. Аварийная макс."),
+ hook_weight = table.Column(type: "double precision", nullable: true, comment: "Вес на крюке"),
+ hook_weight_idle = table.Column(type: "double precision", nullable: true, comment: "Вес на крюке. Холостой ход"),
+ hook_weight_limit_min = table.Column(type: "double precision", nullable: true, comment: "Вес на крюке. Посадка"),
+ hook_weight_limit_max = table.Column(type: "double precision", nullable: true, comment: "Вес на крюке. Затяжка"),
+ rotor_torque = table.Column(type: "double precision", nullable: true, comment: "Момент на роторе"),
+ rotor_torque_idle = table.Column(type: "double precision", nullable: true, comment: "Момент на роторе. Холостой ход"),
+ rotor_torque_sp = table.Column(type: "double precision", nullable: true, comment: "Момент на роторе. Задание"),
+ rotor_torque_limit_max = table.Column(type: "double precision", nullable: true, comment: "Момент на роторе. Аварийный макс."),
+ rotor_speed = table.Column(type: "double precision", nullable: true, comment: "Обороты ротора"),
+ flow = table.Column(type: "double precision", nullable: true, comment: "Расход"),
+ flow_idle = table.Column(type: "double precision", nullable: true, comment: "Расход. Холостой ход"),
+ flow_delta_limit_max = table.Column(type: "double precision", nullable: true, comment: "Расход. Аварийный макс."),
+ id_feed_regulator = table.Column(type: "double precision", nullable: true, comment: "Текущий критерий бурения"),
+ mse_state = table.Column(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(type: "integer", nullable: false),
+ id_telemetry = table.Column(type: "integer", nullable: false),
+ id_category = table.Column(type: "integer", nullable: false),
+ message_template = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ id_telemetry = table.Column(type: "integer", nullable: false),
+ id_event = table.Column(type: "integer", nullable: false),
+ id_telemetry_user = table.Column(type: "integer", nullable: true, comment: "Пользователь панели отправляющей телеметрию. не пользователь облака."),
+ date = table.Column(type: "timestamp with time zone", nullable: false),
+ arg0 = table.Column(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Аргумент №0 для вставки в шаблон сообщения"),
+ arg1 = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ arg2 = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ arg3 = table.Column(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(type: "integer", nullable: false),
+ id_telemetry = table.Column(type: "integer", nullable: false),
+ name = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ surname = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ patronymic = table.Column(type: "character varying(255)", maxLength: 255, nullable: true),
+ level = table.Column(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(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ id_telemetry = table.Column(type: "integer", nullable: false),
+ id_operation = table.Column(type: "integer", nullable: false),
+ unix_date = table.Column(type: "bigint", nullable: false, comment: "Unix timestamp для Linq запросов с вычислением дат"),
+ duration_sec = table.Column