Remove legacy telemetry analysis db model

This commit is contained in:
ngfrolov 2022-04-29 14:29:45 +05:00
parent 579b5f26da
commit 93156ef6f8
12 changed files with 17563 additions and 287 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Remove_old_analytics_stage1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_analysis_t_operation_id_fk",
table: "t_telemetry_analysis");
migrationBuilder.DropForeignKey(
name: "t_analysis_t_telemetry_id_fk",
table: "t_telemetry_analysis");
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_analysis_t_telemetry_id_telemetry",
table: "t_telemetry_analysis",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_analysis_t_well_operation_category_id_operation",
table: "t_telemetry_analysis",
column: "id_operation",
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_analysis_t_telemetry_id_telemetry",
table: "t_telemetry_analysis");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_analysis_t_well_operation_category_id_operation",
table: "t_telemetry_analysis");
migrationBuilder.AddForeignKey(
name: "t_analysis_t_operation_id_fk",
table: "t_telemetry_analysis",
column: "id_operation",
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "t_analysis_t_telemetry_id_fk",
table: "t_telemetry_analysis",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Remove_old_analytics_stage2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_analysis_t_telemetry_id_telemetry",
table: "t_telemetry_analysis");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_analysis_t_well_operation_category_id_operation",
table: "t_telemetry_analysis");
migrationBuilder.DropIndex(
name: "IX_t_telemetry_analysis_id_operation",
table: "t_telemetry_analysis");
migrationBuilder.DropIndex(
name: "IX_t_telemetry_analysis_id_telemetry",
table: "t_telemetry_analysis");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
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.AddForeignKey(
name: "FK_t_telemetry_analysis_t_telemetry_id_telemetry",
table: "t_telemetry_analysis",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_analysis_t_well_operation_category_id_operation",
table: "t_telemetry_analysis",
column: "id_operation",
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Remove_old_analytics_stage3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_telemetry_analysis");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_telemetry_analysis",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
duration_sec = table.Column<int>(type: "integer", nullable: false, comment: "Кол-во секунд после предыдущей операции"),
id_operation = table.Column<int>(type: "integer", nullable: false),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
is_bit_position_decreasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Долото поднимается"),
is_bit_position_increasing = 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_decresing = table.Column<bool>(type: "boolean", nullable: false, comment: "Талевый блок поднимается"),
is_block_posision_incresing = table.Column<bool>(type: "boolean", nullable: false, comment: "Талевый блок спускается"),
is_hook_weight_lt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Вес на крюке менее 3т"),
is_hook_weight_not_changes = table.Column<bool>(type: "boolean", nullable: false, comment: "Вес на крюке не меняется"),
is_pressure_gt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Давление более 20"),
is_pressure_lt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Давление менее 20"),
is_rotor_speed_gt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Обороты ротора выше 3"),
is_rotor_speed_lt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Обороты ротора ниже 3"),
is_well_depth_decreasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Глубина забоя не увеличивается"),
is_well_depth_increasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Глубина забоя увеличивается"),
operation_end_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина, на которой закончилась операция"),
operation_start_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина, на которой началась операция"),
unix_date = table.Column<long>(type: "bigint", nullable: false, comment: "Unix timestamp для Linq запросов с вычислением дат")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_analysis", x => x.id);
},
comment: "События на скважине");
}
}
}

View File

@ -61,7 +61,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdDeposit");
b.ToTable("t_cluster", (string)null);
b.ToTable("t_cluster");
b.HasComment("Кусты");
});
@ -90,7 +90,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdCompanyType");
b.ToTable("t_company", (string)null);
b.ToTable("t_company");
b.HasData(
new
@ -117,7 +117,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_company_type", (string)null);
b.ToTable("t_company_type");
b.HasData(
new
@ -166,7 +166,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_deposit", (string)null);
b.ToTable("t_deposit");
b.HasComment("Месторождение");
});
@ -220,7 +220,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry");
b.ToTable("t_detected_operation", (string)null);
b.ToTable("t_detected_operation");
b.HasComment("автоматически определенные операции по телеметрии");
});
@ -315,7 +315,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellOperationCategory");
b.ToTable("t_drill_flow_chart", (string)null);
b.ToTable("t_drill_flow_chart");
b.HasComment("Параметры коридоров бурения (диапазоны параметров бурения)");
});
@ -344,7 +344,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell", "IdFileCategory")
.IsUnique();
b.ToTable("t_drilling_program_part", (string)null);
b.ToTable("t_drilling_program_part");
b.HasComment("части программ бурения");
});
@ -459,7 +459,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType");
b.ToTable("t_drill_params", (string)null);
b.ToTable("t_drill_params");
b.HasComment("Режим бурения в секции (диапазоны параметров бурения)");
});
@ -485,7 +485,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_file_category", (string)null);
b.ToTable("t_file_category");
b.HasComment("Категории файлов");
@ -659,7 +659,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_file_info", (string)null);
b.ToTable("t_file_info");
b.HasComment("Файлы всех категорий");
});
@ -710,7 +710,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUser");
b.ToTable("t_file_mark", (string)null);
b.ToTable("t_file_mark");
b.HasComment("Действия с файлами.");
});
@ -755,7 +755,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_measure", (string)null);
b.ToTable("t_measure");
b.HasComment("Таблица c данными для вкладки 'Последние данные'");
});
@ -781,7 +781,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_measure_category", (string)null);
b.ToTable("t_measure_category");
b.HasComment("Категория последних данных");
@ -829,7 +829,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_permission", (string)null);
b.ToTable("t_permission");
b.HasComment("Разрешения на доступ к данным");
@ -1432,7 +1432,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_relation_company_well", (string)null);
b.ToTable("t_relation_company_well");
b.HasComment("отношение скважин и компаний");
});
@ -1457,7 +1457,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdDrillingProgramPart");
b.ToTable("t_relation_user_drilling_program_part", (string)null);
b.ToTable("t_relation_user_drilling_program_part");
b.HasComment("Отношение пользователей и частей ПБ");
});
@ -1476,7 +1476,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdPermission");
b.ToTable("t_relation_user_role_permission", (string)null);
b.ToTable("t_relation_user_role_permission");
b.HasComment("Отношение ролей пользователей и разрешений доступа");
@ -2058,7 +2058,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdInclude");
b.ToTable("t_relation_user_role_user_role", (string)null);
b.ToTable("t_relation_user_role_user_role");
b.HasComment("Отношение ролей к ролям");
@ -2349,7 +2349,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUserRole");
b.ToTable("t_relation_user_user_role", (string)null);
b.ToTable("t_relation_user_user_role");
b.HasComment("Отношение пользователей и ролей");
@ -2405,7 +2405,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_report_property", (string)null);
b.ToTable("t_report_property");
b.HasComment("Отчеты с данными по буровым");
});
@ -2459,7 +2459,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_setpoints_rquest", (string)null);
b.ToTable("t_setpoints_rquest");
b.HasComment("Запросы на изменение уставок панели оператора");
});
@ -2492,124 +2492,11 @@ namespace AsbCloudDb.Migrations
b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index");
b.ToTable("t_telemetry", (string)null);
b.ToTable("t_telemetry");
b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине.");
});
modelBuilder.Entity("AsbCloudDb.Model.TelemetryAnalysis", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DurationSec")
.HasColumnType("integer")
.HasColumnName("duration_sec")
.HasComment("Кол-во секунд после предыдущей операции");
b.Property<int>("IdOperation")
.HasColumnType("integer")
.HasColumnName("id_operation");
b.Property<int>("IdTelemetry")
.HasColumnType("integer")
.HasColumnName("id_telemetry");
b.Property<bool>("IsBitPositionDecreasing")
.HasColumnType("boolean")
.HasColumnName("is_bit_position_decreasing")
.HasComment("Долото поднимается");
b.Property<bool>("IsBitPositionIncreasing")
.HasColumnType("boolean")
.HasColumnName("is_bit_position_increasing")
.HasComment("Долото спускается");
b.Property<bool>("IsBitPositionLt20")
.HasColumnType("boolean")
.HasColumnName("is_bit_posision_lt_20")
.HasComment("Положение долота меньше 20м");
b.Property<bool>("IsBlockPositionDecreasing")
.HasColumnType("boolean")
.HasColumnName("is_block_posision_decresing")
.HasComment("Талевый блок поднимается");
b.Property<bool>("IsBlockPositionIncreasing")
.HasColumnType("boolean")
.HasColumnName("is_block_posision_incresing")
.HasComment("Талевый блок спускается");
b.Property<bool>("IsHookWeightLt3")
.HasColumnType("boolean")
.HasColumnName("is_hook_weight_lt_3")
.HasComment("Вес на крюке менее 3т");
b.Property<bool>("IsHookWeightNotChanges")
.HasColumnType("boolean")
.HasColumnName("is_hook_weight_not_changes")
.HasComment("Вес на крюке не меняется");
b.Property<bool>("IsPressureGt20")
.HasColumnType("boolean")
.HasColumnName("is_pressure_gt_20")
.HasComment("Давление более 20");
b.Property<bool>("IsPressureLt20")
.HasColumnType("boolean")
.HasColumnName("is_pressure_lt_20")
.HasComment("Давление менее 20");
b.Property<bool>("IsRotorSpeedGt5")
.HasColumnType("boolean")
.HasColumnName("is_rotor_speed_gt_3")
.HasComment("Обороты ротора выше 3");
b.Property<bool>("IsRotorSpeedLt5")
.HasColumnType("boolean")
.HasColumnName("is_rotor_speed_lt_3")
.HasComment("Обороты ротора ниже 3");
b.Property<bool>("IsWellDepthDecreasing")
.HasColumnType("boolean")
.HasColumnName("is_well_depth_decreasing")
.HasComment("Глубина забоя не увеличивается");
b.Property<bool>("IsWellDepthIncreasing")
.HasColumnType("boolean")
.HasColumnName("is_well_depth_increasing")
.HasComment("Глубина забоя увеличивается");
b.Property<double?>("OperationEndDepth")
.HasColumnType("double precision")
.HasColumnName("operation_end_depth")
.HasComment("Глубина, на которой закончилась операция");
b.Property<double?>("OperationStartDepth")
.HasColumnType("double precision")
.HasColumnName("operation_start_depth")
.HasComment("Глубина, на которой началась операция");
b.Property<long>("UnixDate")
.HasColumnType("bigint")
.HasColumnName("unix_date")
.HasComment("Unix timestamp для Linq запросов с вычислением дат");
b.HasKey("Id");
b.HasIndex("IdOperation");
b.HasIndex("IdTelemetry");
b.ToTable("t_telemetry_analysis", (string)null);
b.HasComment("События на скважине");
});
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b =>
{
b.Property<int>("IdTelemetry")
@ -2808,7 +2695,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_data_saub", (string)null);
b.ToTable("t_telemetry_data_saub");
b.HasComment("набор основных данных по SAUB");
});
@ -3120,7 +3007,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_data_spin", (string)null);
b.ToTable("t_telemetry_data_spin");
b.HasComment("набор основных данных по SpinMaster");
});
@ -3145,7 +3032,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "IdEvent");
b.ToTable("t_telemetry_event", (string)null);
b.ToTable("t_telemetry_event");
b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
});
@ -3205,7 +3092,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry");
b.ToTable("t_telemetry_message", (string)null);
b.ToTable("t_telemetry_message");
b.HasComment("Сообщения на буровых");
});
@ -3241,7 +3128,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "IdUser");
b.ToTable("t_telemetry_user", (string)null);
b.ToTable("t_telemetry_user");
b.HasComment("Пользователи панели САУБ. Для сообщений.");
});
@ -3318,7 +3205,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("Login")
.IsUnique();
b.ToTable("t_user", (string)null);
b.ToTable("t_user");
b.HasComment("Пользователи облака");
@ -3355,7 +3242,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_user_role", (string)null);
b.ToTable("t_user_role");
b.HasComment("Роли пользователей в системе");
@ -3727,7 +3614,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellType");
b.ToTable("t_well", (string)null);
b.ToTable("t_well");
b.HasComment("скважины");
});
@ -3755,7 +3642,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSrc");
b.ToTable("t_well_composite", (string)null);
b.ToTable("t_well_composite");
b.HasComment("Композитная скважина");
});
@ -3831,7 +3718,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType");
b.ToTable("t_well_operation", (string)null);
b.ToTable("t_well_operation");
b.HasComment("Данные по операциям на скважине");
});
@ -3857,7 +3744,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_well_operation_category", (string)null);
b.ToTable("t_well_operation_category");
b.HasComment("Справочник операций на скважине");
@ -4289,7 +4176,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_well_section_type", (string)null);
b.ToTable("t_well_section_type");
b.HasComment("конструкция секции скважины");
@ -4463,7 +4350,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_well_type", (string)null);
b.ToTable("t_well_type");
b.HasComment("конструкция скважины");
@ -4520,7 +4407,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("RecordBase", (string)null);
b.ToTable("RecordBase");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
@ -4684,7 +4571,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_1", (string)null);
b.ToTable("t_telemetry_wits_1");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b =>
@ -4772,7 +4659,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_50", (string)null);
b.ToTable("t_telemetry_wits_50");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b =>
@ -4824,7 +4711,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_60", (string)null);
b.ToTable("t_telemetry_wits_60");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b =>
@ -4880,7 +4767,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_61", (string)null);
b.ToTable("t_telemetry_wits_61");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b =>
@ -4968,7 +4855,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_7", (string)null);
b.ToTable("t_telemetry_wits_7");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b =>
@ -5172,7 +5059,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_8", (string)null);
b.ToTable("t_telemetry_wits_8");
});
modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
@ -5465,27 +5352,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well");
});
modelBuilder.Entity("AsbCloudDb.Model.TelemetryAnalysis", b =>
{
b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Operation")
.WithMany("Analysis")
.HasForeignKey("IdOperation")
.OnDelete(DeleteBehavior.SetNull)
.IsRequired()
.HasConstraintName("t_analysis_t_operation_id_fk");
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
.WithMany("Analysis")
.HasForeignKey("IdTelemetry")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("t_analysis_t_telemetry_id_fk");
b.Navigation("Operation");
b.Navigation("Telemetry");
});
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b =>
{
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
@ -5772,8 +5638,6 @@ namespace AsbCloudDb.Migrations
modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b =>
{
b.Navigation("Analysis");
b.Navigation("DataSaub");
b.Navigation("DataSpin");
@ -5818,11 +5682,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("WellOperations");
});
modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b =>
{
b.Navigation("Analysis");
});
modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b =>
{
b.Navigation("DrillParamsCollection");

View File

@ -24,7 +24,6 @@ namespace AsbCloudDb.Model
public virtual DbSet<Telemetry> Telemetries { get; set; }
public virtual DbSet<TelemetryDataSaub> TelemetryDataSaub { get; set; }
public virtual DbSet<TelemetryDataSpin> TelemetryDataSpin { get; set; }
public virtual DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
public virtual DbSet<TelemetryEvent> TelemetryEvents { get; set; }
public virtual DbSet<TelemetryMessage> TelemetryMessages { get; set; }
public virtual DbSet<TelemetryUser> TelemetryUsers { get; set; }
@ -164,21 +163,6 @@ namespace AsbCloudDb.Model
.HasConstraintName("t_telemetry_user_t_telemetry_id_fk");
});
modelBuilder.Entity<TelemetryAnalysis>(entity =>
{
entity.HasOne(d => d.Telemetry)
.WithMany(p => p.Analysis)
.HasForeignKey(d => d.IdTelemetry)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("t_analysis_t_telemetry_id_fk");
entity.HasOne(d => d.Operation)
.WithMany(p => p.Analysis)
.HasForeignKey(d => d.IdOperation)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("t_analysis_t_operation_id_fk");
});
modelBuilder.Entity<TelemetryEvent>(entity =>
{
entity.HasKey(nameof(TelemetryEvent.IdTelemetry), nameof(TelemetryEvent.IdEvent));

View File

@ -23,7 +23,6 @@ namespace AsbCloudDb.Model
DbSet<Telemetry> Telemetries { get; set; }
DbSet<TelemetryUser> TelemetryUsers { get; set; }
DbSet<WellOperationCategory> WellOperationCategories { get; set; }
DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
DbSet<Well> Wells { get; set; }
DbSet<WellComposite> WellComposites { get; set; }
DbSet<WellSectionType> WellSectionTypes { get; set; }

View File

@ -48,7 +48,5 @@ namespace AsbCloudDb.Model
[InverseProperty(nameof(TelemetryEvent.Telemetry))]
public virtual ICollection<TelemetryEvent> Events { get; set; }
[InverseProperty(nameof(TelemetryAnalysis.Telemetry))]
public virtual ICollection<TelemetryAnalysis> Analysis { get; set; }
}
}

View File

@ -1,83 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
[Table("t_telemetry_analysis"), Comment("События на скважине")]
public class TelemetryAnalysis : IId
{
[Key]
[Column("id")]
public int Id { get; set; }
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[Column("id_operation")]
public int IdOperation { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdTelemetry))]
[InverseProperty(nameof(Model.Telemetry.Analysis))]
public virtual Telemetry Telemetry { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdOperation))]
[InverseProperty(nameof(Model.WellOperationCategory.Analysis))]
public virtual WellOperationCategory Operation { get; set; }
[Column("unix_date", TypeName = "bigint"), Comment("Unix timestamp для Linq запросов с вычислением дат")]
public long UnixDate { get; set; }
[Column("duration_sec"), Comment("Кол-во секунд после предыдущей операции")]
public int DurationSec { get; set; }
[Column("operation_start_depth"), Comment("Глубина, на которой началась операция")]
public double? OperationStartDepth { get; set; }
[Column("operation_end_depth"), Comment("Глубина, на которой закончилась операция")]
public double? OperationEndDepth { get; set; }
[Column("is_well_depth_increasing"), Comment("Глубина забоя увеличивается")]
public bool IsWellDepthIncreasing { get; set; }
[Column("is_well_depth_decreasing"), Comment("Глубина забоя не увеличивается")]
public bool IsWellDepthDecreasing { get; set; }
[Column("is_bit_position_increasing"), Comment("Долото спускается")]
public bool IsBitPositionIncreasing { get; set; }
[Column("is_bit_position_decreasing"), Comment("Долото поднимается")]
public bool IsBitPositionDecreasing { get; set; }
[Column("is_bit_posision_lt_20"), Comment("Положение долота меньше 20м")]
public bool IsBitPositionLt20 { get; set; }
[Column("is_block_posision_incresing"), Comment("Талевый блок спускается")]
public bool IsBlockPositionIncreasing { get; set; }
[Column("is_block_posision_decresing"), Comment("Талевый блок поднимается")]
public bool IsBlockPositionDecreasing { get; set; }
[Column("is_rotor_speed_lt_3"), Comment("Обороты ротора ниже 3")]
public bool IsRotorSpeedLt5 { get; set; }
[Column("is_rotor_speed_gt_3"), Comment("Обороты ротора выше 3")]
public bool IsRotorSpeedGt5 { get; set; }
[Column("is_pressure_lt_20"), Comment("Давление менее 20")]
public bool IsPressureLt20 { get; set; }
[Column("is_pressure_gt_20"), Comment("Давление более 20")]
public bool IsPressureGt20 { get; set; }
[Column("is_hook_weight_not_changes"), Comment("Вес на крюке не меняется")]
public bool IsHookWeightNotChanges { get; set; }
[Column("is_hook_weight_lt_3"), Comment("Вес на крюке менее 3т")]
public bool IsHookWeightLt3 { get; set; }
}
}

View File

@ -18,7 +18,5 @@ namespace AsbCloudDb.Model
[Column("code"), Comment("Код операции")]
public int Code { get; set; }
[InverseProperty(nameof(TelemetryAnalysis.Operation))]
public virtual ICollection<TelemetryAnalysis> Analysis { get; set; }
}
}