new db model

remove migrations
This commit is contained in:
eugeniy_ivanov 2023-03-28 21:47:34 +05:00
parent 118df71ccf
commit 3df7437955
10 changed files with 111 additions and 16259 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,139 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class add_table_wits_gtr : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_wits_base",
columns: table => new
{
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_record = table.Column<int>(type: "integer", nullable: false),
id_item = table.Column<int>(type: "integer", nullable: false),
date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_wits_base", x => new { x.id_telemetry, x.id_record, x.id_item });
},
comment: "таблица данных ГТИ");
migrationBuilder.CreateTable(
name: "t_wits_float",
columns: table => new
{
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_record = table.Column<int>(type: "integer", nullable: false),
id_item = table.Column<int>(type: "integer", nullable: false),
value = table.Column<float>(type: "real", nullable: true),
TelemetryId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_wits_float", x => new { x.id_telemetry, x.id_record, x.id_item });
table.ForeignKey(
name: "FK_t_wits_float_t_telemetry_TelemetryId",
column: x => x.TelemetryId,
principalTable: "t_telemetry",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_wits_float_t_wits_base_id_telemetry_id_record_id_item",
columns: x => new { x.id_telemetry, x.id_record, x.id_item },
principalTable: "t_wits_base",
principalColumns: new[] { "id_telemetry", "id_record", "id_item" },
onDelete: ReferentialAction.Cascade);
},
comment: "таблица данных ГТИ с типом значения float");
migrationBuilder.CreateTable(
name: "t_wits_int",
columns: table => new
{
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_record = table.Column<int>(type: "integer", nullable: false),
id_item = table.Column<int>(type: "integer", nullable: false),
Value = table.Column<long>(type: "bigint", nullable: true),
TelemetryId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_wits_int", x => new { x.id_telemetry, x.id_record, x.id_item });
table.ForeignKey(
name: "FK_t_wits_int_t_telemetry_TelemetryId",
column: x => x.TelemetryId,
principalTable: "t_telemetry",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_wits_int_t_wits_base_id_telemetry_id_record_id_item",
columns: x => new { x.id_telemetry, x.id_record, x.id_item },
principalTable: "t_wits_base",
principalColumns: new[] { "id_telemetry", "id_record", "id_item" },
onDelete: ReferentialAction.Cascade);
},
comment: "таблица данных ГТИ с типом значения int16 int32");
migrationBuilder.CreateTable(
name: "t_wits_string",
columns: table => new
{
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_record = table.Column<int>(type: "integer", nullable: false),
id_item = table.Column<int>(type: "integer", nullable: false),
value = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
TelemetryId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_wits_string", x => new { x.id_telemetry, x.id_record, x.id_item });
table.ForeignKey(
name: "FK_t_wits_string_t_telemetry_TelemetryId",
column: x => x.TelemetryId,
principalTable: "t_telemetry",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_wits_string_t_wits_base_id_telemetry_id_record_id_item",
columns: x => new { x.id_telemetry, x.id_record, x.id_item },
principalTable: "t_wits_base",
principalColumns: new[] { "id_telemetry", "id_record", "id_item" },
onDelete: ReferentialAction.Cascade);
},
comment: "таблица данных ГТИ с типом значения string");
migrationBuilder.CreateIndex(
name: "IX_t_wits_float_TelemetryId",
table: "t_wits_float",
column: "TelemetryId");
migrationBuilder.CreateIndex(
name: "IX_t_wits_int_TelemetryId",
table: "t_wits_int",
column: "TelemetryId");
migrationBuilder.CreateIndex(
name: "IX_t_wits_string_TelemetryId",
table: "t_wits_string",
column: "TelemetryId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_wits_float");
migrationBuilder.DropTable(
name: "t_wits_int");
migrationBuilder.DropTable(
name: "t_wits_string");
migrationBuilder.DropTable(
name: "t_wits_base");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WITS_GTR_manual_hypertable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql
("SELECT create_hypertable('t_wits_base','time','id_telemetry',chunk_time_interval => INTERVAL '5 day'); " +
"SELECT create_hypertable('t_wits_string','time','id_telemetry',chunk_time_interval => INTERVAL '5 day'); " +
"SELECT create_hypertable('t_wits_float','time','id_telemetry',chunk_time_interval => INTERVAL '5 day'); " +
"SELECT create_hypertable('t_wits_int','time','id_telemetry',chunk_time_interval => INTERVAL '5 day'); ");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -63,7 +63,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdDeposit");
b.ToTable("t_cluster");
b.ToTable("t_cluster", (string)null);
b.HasComment("Кусты");
});
@ -93,7 +93,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdCompanyType");
b.ToTable("t_company");
b.ToTable("t_company", (string)null);
b.HasData(
new
@ -121,7 +121,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_company_type");
b.ToTable("t_company_type", (string)null);
b.HasData(
new
@ -162,7 +162,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdWell", "StartDate")
.HasName("t_id_well_date_start_pk");
b.ToTable("t_daily_report");
b.ToTable("t_daily_report", (string)null);
b.HasComment("Ежедневные отчёты");
});
@ -198,7 +198,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_deposit");
b.ToTable("t_deposit", (string)null);
b.HasComment("Месторождение");
});
@ -262,7 +262,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry");
b.ToTable("t_detected_operation");
b.ToTable("t_detected_operation", (string)null);
b.HasComment("автоматически определенные операции по телеметрии");
});
@ -299,7 +299,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_driller");
b.ToTable("t_driller", (string)null);
b.HasComment("Бурильщик");
});
@ -328,7 +328,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell", "IdFileCategory")
.IsUnique();
b.ToTable("t_drilling_program_part");
b.ToTable("t_drilling_program_part", (string)null);
b.HasComment("части программ бурения");
});
@ -355,7 +355,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_file_category");
b.ToTable("t_file_category", (string)null);
b.HasComment("Категории файлов");
@ -745,7 +745,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_file_info");
b.ToTable("t_file_info", (string)null);
b.HasComment("Файлы всех категорий");
});
@ -796,36 +796,11 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUser");
b.ToTable("t_file_mark");
b.ToTable("t_file_mark", (string)null);
b.HasComment("Действия с файлами.");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsBase", b =>
{
b.Property<int>("IdTelemetry")
.HasColumnType("integer")
.HasColumnName("id_telemetry");
b.Property<int>("IdRecord")
.HasColumnType("integer")
.HasColumnName("id_record");
b.Property<int>("IdItem")
.HasColumnType("integer")
.HasColumnName("id_item");
b.Property<DateTimeOffset>("DateTime")
.HasColumnType("timestamp with time zone")
.HasColumnName("date");
b.HasKey("IdTelemetry", "IdRecord", "IdItem");
b.ToTable("t_wits_base");
b.HasComment("таблица данных ГТИ");
});
modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b =>
{
b.Property<int>("Id")
@ -863,7 +838,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry");
b.ToTable("t_limiting_parameter");
b.ToTable("t_limiting_parameter", (string)null);
b.HasComment("Ограничения по параметрам телеметрии");
});
@ -909,7 +884,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_measure");
b.ToTable("t_measure", (string)null);
b.HasComment("Таблица c данными для вкладки 'Последние данные'");
});
@ -936,7 +911,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_measure_category");
b.ToTable("t_measure_category", (string)null);
b.HasComment("Категория последних данных");
@ -1007,7 +982,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_operationvalue");
b.ToTable("t_operationvalue", (string)null);
b.HasComment("Целевые/нормативные показатели операции");
});
@ -1036,7 +1011,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_permission");
b.ToTable("t_permission", (string)null);
b.HasComment("Разрешения на доступ к данным");
@ -1946,7 +1921,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_planned_trajectory");
b.ToTable("t_planned_trajectory", (string)null);
b.HasComment("Загрузка плановой траектории");
});
@ -2066,7 +2041,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map");
b.ToTable("t_process_map", (string)null);
b.HasComment("Операции по скважине РТК");
});
@ -2085,7 +2060,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_relation_company_well");
b.ToTable("t_relation_company_well", (string)null);
b.HasComment("отношение скважин и компаний");
});
@ -2110,7 +2085,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdDrillingProgramPart");
b.ToTable("t_relation_user_drilling_program_part");
b.ToTable("t_relation_user_drilling_program_part", (string)null);
b.HasComment("Отношение пользователей и частей ПБ");
});
@ -2129,7 +2104,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdPermission");
b.ToTable("t_relation_user_role_permission");
b.ToTable("t_relation_user_role_permission", (string)null);
b.HasComment("Отношение ролей пользователей и разрешений доступа");
@ -3386,7 +3361,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdInclude");
b.ToTable("t_relation_user_role_user_role");
b.ToTable("t_relation_user_role_user_role", (string)null);
b.HasComment("Отношение ролей к ролям");
@ -3677,7 +3652,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUserRole");
b.ToTable("t_relation_user_user_role");
b.ToTable("t_relation_user_user_role", (string)null);
b.HasComment("Отношение пользователей и ролей");
@ -3733,7 +3708,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_report_property");
b.ToTable("t_report_property", (string)null);
b.HasComment("Отчеты с данными по буровым");
});
@ -3784,7 +3759,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_schedule");
b.ToTable("t_schedule", (string)null);
b.HasComment("График работы бурильщика");
});
@ -3839,7 +3814,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_setpoints_rquest");
b.ToTable("t_setpoints_rquest", (string)null);
b.HasComment("Запросы на изменение уставок панели оператора");
});
@ -3866,7 +3841,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_subsystem");
b.ToTable("t_subsystem", (string)null);
b.HasComment("Описание подсистем");
@ -3941,7 +3916,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry");
b.ToTable("t_subsystem_operation_time");
b.ToTable("t_subsystem_operation_time", (string)null);
b.HasComment("наработки подсистем");
});
@ -3977,7 +3952,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index");
b.ToTable("t_telemetry");
b.ToTable("t_telemetry", (string)null);
b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине.");
});
@ -4180,7 +4155,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_data_saub");
b.ToTable("t_telemetry_data_saub", (string)null);
b.HasComment("набор основных данных по SAUB");
});
@ -4277,7 +4252,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_data_spin");
b.ToTable("t_telemetry_data_spin", (string)null);
b.HasComment("набор основных данных по SpinMaster");
});
@ -4303,7 +4278,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "IdEvent");
b.ToTable("t_telemetry_event");
b.ToTable("t_telemetry_event", (string)null);
b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
});
@ -4363,7 +4338,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry");
b.ToTable("t_telemetry_message");
b.ToTable("t_telemetry_message", (string)null);
b.HasComment("Сообщения на буровых");
});
@ -4400,7 +4375,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "IdUser");
b.ToTable("t_telemetry_user");
b.ToTable("t_telemetry_user", (string)null);
b.HasComment("Пользователи панели САУБ. Для сообщений.");
});
@ -4442,7 +4417,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry");
b.ToTable("t_telemetry_wireline_run_out");
b.ToTable("t_telemetry_wireline_run_out", (string)null);
b.HasComment("Наработка талевого каната");
});
@ -4522,7 +4497,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("Login")
.IsUnique();
b.ToTable("t_user");
b.ToTable("t_user", (string)null);
b.HasComment("Пользователи облака");
@ -4561,7 +4536,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_user_role");
b.ToTable("t_user_role", (string)null);
b.HasComment("Роли пользователей в системе");
@ -4899,7 +4874,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdUser", "Key");
b.ToTable("t_user_settings");
b.ToTable("t_user_settings", (string)null);
b.HasComment("настройки интерфейса пользователя");
});
@ -4959,7 +4934,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellType");
b.ToTable("t_well");
b.ToTable("t_well", (string)null);
b.HasComment("скважины");
});
@ -4987,7 +4962,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSrc");
b.ToTable("t_well_composite");
b.ToTable("t_well_composite", (string)null);
b.HasComment("Композитная скважина");
});
@ -5013,7 +4988,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUser");
b.ToTable("t_well_final_documents");
b.ToTable("t_well_final_documents", (string)null);
b.HasComment("Дело скважины");
});
@ -5096,7 +5071,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType");
b.ToTable("t_well_operation");
b.ToTable("t_well_operation", (string)null);
b.HasComment("Данные по операциям на скважине");
});
@ -5137,7 +5112,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdParent");
b.ToTable("t_well_operation_category");
b.ToTable("t_well_operation_category", (string)null);
b.HasComment("Справочник операций на скважине");
@ -6148,7 +6123,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_well_section_type");
b.ToTable("t_well_section_type", (string)null);
b.HasComment("конструкция секции скважины");
@ -6338,7 +6313,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
b.ToTable("t_well_type");
b.ToTable("t_well_type", (string)null);
b.HasComment("конструкция скважины");
@ -6395,62 +6370,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_wits_base");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsFloat", b =>
{
b.HasBaseType("AsbCloudDb.Model.GTR.WitsBase");
b.Property<int?>("TelemetryId")
.HasColumnType("integer");
b.Property<float?>("Value")
.HasColumnType("real")
.HasColumnName("value");
b.HasIndex("TelemetryId");
b.ToTable("t_wits_float");
b.HasComment("таблица данных ГТИ с типом значения float");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsInt", b =>
{
b.HasBaseType("AsbCloudDb.Model.GTR.WitsBase");
b.Property<int?>("TelemetryId")
.HasColumnType("integer");
b.Property<long?>("Value")
.HasColumnType("bigint")
.HasColumnName("Value");
b.HasIndex("TelemetryId");
b.ToTable("t_wits_int");
b.HasComment("таблица данных ГТИ с типом значения int16 int32");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsStr", b =>
{
b.HasBaseType("AsbCloudDb.Model.GTR.WitsBase");
b.Property<int?>("TelemetryId")
.HasColumnType("integer");
b.Property<string>("Value")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("value");
b.HasIndex("TelemetryId");
b.ToTable("t_wits_string");
b.HasComment("таблица данных ГТИ с типом значения string");
b.ToTable("t_telemetry_wits_base", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
@ -6614,7 +6534,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_1");
b.ToTable("t_telemetry_wits_1", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b =>
@ -6702,7 +6622,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_50");
b.ToTable("t_telemetry_wits_50", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b =>
@ -6754,7 +6674,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_60");
b.ToTable("t_telemetry_wits_60", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b =>
@ -6810,7 +6730,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_61");
b.ToTable("t_telemetry_wits_61", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b =>
@ -6898,7 +6818,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_7");
b.ToTable("t_telemetry_wits_7", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b =>
@ -7102,7 +7022,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_8");
b.ToTable("t_telemetry_wits_8", (string)null);
});
modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
@ -7694,51 +7614,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Parent");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsFloat", b =>
{
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
.WithMany()
.HasForeignKey("TelemetryId");
b.HasOne("AsbCloudDb.Model.GTR.WitsBase", null)
.WithOne()
.HasForeignKey("AsbCloudDb.Model.GTR.WitsFloat", "IdTelemetry", "IdRecord", "IdItem")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Telemetry");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsInt", b =>
{
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
.WithMany()
.HasForeignKey("TelemetryId");
b.HasOne("AsbCloudDb.Model.GTR.WitsBase", null)
.WithOne()
.HasForeignKey("AsbCloudDb.Model.GTR.WitsInt", "IdTelemetry", "IdRecord", "IdItem")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Telemetry");
});
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsStr", b =>
{
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
.WithMany()
.HasForeignKey("TelemetryId");
b.HasOne("AsbCloudDb.Model.GTR.WitsBase", null)
.WithOne()
.HasForeignKey("AsbCloudDb.Model.GTR.WitsStr", "IdTelemetry", "IdRecord", "IdItem")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Telemetry");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
{
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")

View File

@ -0,0 +1,8 @@
namespace AsbCloudDb.Model.GTR
{
public interface IWitsBase:ITelemetryData
{
public int IdRecord { get; set; }
public int IdItem { get; set; }
}
}

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.GTR
{
[Table("t_wits_base"), Comment("таблица данных ГТИ")]
public abstract class WitsBase : ITelemetryData
{
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[Column("id_record")]
public int IdRecord { get; set; }
[Column("id_item")]
public int IdItem { get; set; }
[Column("date", TypeName = "timestamp with time zone")]
public DateTimeOffset DateTime { get; set; }
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry? Telemetry { get; set; }
}
}

View File

@ -1,12 +1,27 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.GTR
{
[Table("t_wits_float"), Comment("таблица данных ГТИ с типом значения float")]
public class WitsFloat : WitsBase
public class WitsFloat : IWitsBase
{
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[Column("id_record")]
public int IdRecord { get; set; }
[Column("id_item")]
public int IdItem { get; set; }
[Column("date", TypeName = "timestamp with time zone")]
public DateTimeOffset DateTime { get; set; }
[Column("value")]
public float? Value { get; set; }
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry? Telemetry { get; set; }
}
}

View File

@ -1,17 +1,28 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.GTR
{
[Table("t_wits_int"), Comment("таблица данных ГТИ с типом значения int16 int32")]
public class WitsInt : WitsBase
public class WitsInt : IWitsBase
{
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[Column("id_record")]
public int IdRecord { get; set; }
[Column("id_item")]
public int IdItem { get; set; }
[Column("date", TypeName = "timestamp with time zone")]
public DateTimeOffset DateTime { get; set; }
[Column("Value", TypeName = "bigint")]
public int? Value { get; set; }
}
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry? Telemetry { get; set; }
}
}

View File

@ -1,14 +1,30 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.GTR
{
[Table("t_wits_string"), Comment("таблица данных ГТИ с типом значения string")]
public class WitsStr: WitsBase
public class WitsStr: IWitsBase
{
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[Column("id_record")]
public int IdRecord { get; set; }
[Column("id_item")]
public int IdItem { get; set; }
[Column("date", TypeName = "timestamp with time zone")]
public DateTimeOffset DateTime { get; set; }
[Column("value")]
[StringLength(64)]
public string? Value { get; set; }
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry? Telemetry { get; set; }
}
}