forked from ddrilling/AsbCloudServer
Изменение модели данных
This commit is contained in:
parent
866cc4c066
commit
72ec8c69d3
9015
AsbCloudDb/Migrations/20231216060437_Update_Subsystems.Designer.cs
generated
Normal file
9015
AsbCloudDb/Migrations/20231216060437_Update_Subsystems.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
71
AsbCloudDb/Migrations/20231216060437_Update_Subsystems.cs
Normal file
71
AsbCloudDb/Migrations/20231216060437_Update_Subsystems.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class Update_Subsystems : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "t_subsystem_operation_time");
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "t_subsystem",
|
||||||
|
keyColumn: "id",
|
||||||
|
keyValue: 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "t_subsystem_operation_time",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
id_subsystem = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
id_telemetry = table.Column<int>(type: "integer", nullable: false, comment: "ИД телеметрии по которой выдается информация"),
|
||||||
|
date_end = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата/время выключения подсистемы"),
|
||||||
|
date_start = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата/время включения подсистемы"),
|
||||||
|
depth_end = table.Column<float>(type: "real", nullable: true, comment: "глубина забоя на момент выключения подсистемы"),
|
||||||
|
depth_start = table.Column<float>(type: "real", nullable: true, comment: "глубина забоя на момент включения подсистемы")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_t_subsystem_operation_time", x => x.id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_t_subsystem_operation_time_t_subsystem_id_subsystem",
|
||||||
|
column: x => x.id_subsystem,
|
||||||
|
principalTable: "t_subsystem",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_t_subsystem_operation_time_t_telemetry_id_telemetry",
|
||||||
|
column: x => x.id_telemetry,
|
||||||
|
principalTable: "t_telemetry",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
},
|
||||||
|
comment: "наработки подсистем");
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "t_subsystem",
|
||||||
|
columns: new[] { "id", "description", "name" },
|
||||||
|
values: new object[] { 2, "Алгоритм поиска оптимальных параметров бурения САУБ", "MSE" });
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_subsystem_operation_time_id_subsystem",
|
||||||
|
table: "t_subsystem_operation_time",
|
||||||
|
column: "id_subsystem");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_subsystem_operation_time_id_telemetry",
|
||||||
|
table: "t_subsystem_operation_time",
|
||||||
|
column: "id_telemetry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,12 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
@ -4521,7 +4521,7 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.HasComment("Запросы на изменение уставок панели оператора");
|
b.HasComment("Запросы на изменение уставок панели оператора");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Subsystems.Subsystem", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.Subsystem", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -4567,12 +4567,6 @@ namespace AsbCloudDb.Migrations
|
|||||||
Name = "АПД слайд"
|
Name = "АПД слайд"
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Description = "Алгоритм поиска оптимальных параметров бурения САУБ",
|
|
||||||
Name = "MSE"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
{
|
||||||
Id = 65536,
|
Id = 65536,
|
||||||
Description = "Осцилляция",
|
Description = "Осцилляция",
|
||||||
@ -4586,55 +4580,6 @@ namespace AsbCloudDb.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("id");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("DateEnd")
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("date_end")
|
|
||||||
.HasComment("дата/время выключения подсистемы");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("DateStart")
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("date_start")
|
|
||||||
.HasComment("дата/время включения подсистемы");
|
|
||||||
|
|
||||||
b.Property<float?>("DepthEnd")
|
|
||||||
.HasColumnType("real")
|
|
||||||
.HasColumnName("depth_end")
|
|
||||||
.HasComment("глубина забоя на момент выключения подсистемы");
|
|
||||||
|
|
||||||
b.Property<float?>("DepthStart")
|
|
||||||
.HasColumnType("real")
|
|
||||||
.HasColumnName("depth_start")
|
|
||||||
.HasComment("глубина забоя на момент включения подсистемы");
|
|
||||||
|
|
||||||
b.Property<int>("IdSubsystem")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("id_subsystem");
|
|
||||||
|
|
||||||
b.Property<int>("IdTelemetry")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("id_telemetry")
|
|
||||||
.HasComment("ИД телеметрии по которой выдается информация");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("IdSubsystem");
|
|
||||||
|
|
||||||
b.HasIndex("IdTelemetry");
|
|
||||||
|
|
||||||
b.ToTable("t_subsystem_operation_time");
|
|
||||||
|
|
||||||
b.HasComment("наработки подсистем");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -8602,25 +8547,6 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.Navigation("Well");
|
b.Navigation("Well");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("AsbCloudDb.Model.Subsystems.Subsystem", "Subsystem")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("IdSubsystem")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("IdTelemetry")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Subsystem");
|
|
||||||
|
|
||||||
b.Navigation("Telemetry");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AsbCloudDb.Model.GTR;
|
using AsbCloudDb.Model.GTR;
|
||||||
using AsbCloudDb.Model.Subsystems;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -37,7 +36,6 @@ namespace AsbCloudDb.Model
|
|||||||
public virtual DbSet<ReportProperty> ReportProperties => Set<ReportProperty>();
|
public virtual DbSet<ReportProperty> ReportProperties => Set<ReportProperty>();
|
||||||
public virtual DbSet<SetpointsRequest> SetpointsRequests => Set<SetpointsRequest>();
|
public virtual DbSet<SetpointsRequest> SetpointsRequests => Set<SetpointsRequest>();
|
||||||
public virtual DbSet<Subsystem> Subsystems => Set<Subsystem>();
|
public virtual DbSet<Subsystem> Subsystems => Set<Subsystem>();
|
||||||
public virtual DbSet<SubsystemOperationTime> SubsystemOperationTimes => Set<SubsystemOperationTime>();
|
|
||||||
public virtual DbSet<Telemetry> Telemetries => Set<Telemetry>();
|
public virtual DbSet<Telemetry> Telemetries => Set<Telemetry>();
|
||||||
public virtual DbSet<TelemetryDataSaub> TelemetryDataSaub => Set<TelemetryDataSaub>();
|
public virtual DbSet<TelemetryDataSaub> TelemetryDataSaub => Set<TelemetryDataSaub>();
|
||||||
public virtual DbSet<TelemetryDataSaubStat> TelemetryDataSaubStats => Set<TelemetryDataSaubStat>();
|
public virtual DbSet<TelemetryDataSaubStat> TelemetryDataSaubStats => Set<TelemetryDataSaubStat>();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AsbCloudDb.Model.Subsystems;
|
namespace AsbCloudDb.Model.DefaultData
|
||||||
namespace AsbCloudDb.Model.DefaultData
|
|
||||||
{
|
{
|
||||||
internal class EntityFillerSubsystem : EntityFiller<Subsystem>
|
internal class EntityFillerSubsystem : EntityFiller<Subsystem>
|
||||||
{
|
{
|
||||||
@ -8,7 +7,6 @@ namespace AsbCloudDb.Model.DefaultData
|
|||||||
new () {Id = 1, Name = "АКБ", Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\""},
|
new () {Id = 1, Name = "АКБ", Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\""},
|
||||||
new () {Id = 11, Name = "АПД ротор", Description = "Режим работы \"Бурение в роторе\""},
|
new () {Id = 11, Name = "АПД ротор", Description = "Режим работы \"Бурение в роторе\""},
|
||||||
new () {Id = 12, Name = "АПД слайд", Description = "Режим работы \"Бурение в слайде\""},
|
new () {Id = 12, Name = "АПД слайд", Description = "Режим работы \"Бурение в слайде\""},
|
||||||
new () {Id = 2, Name = "MSE", Description = "Алгоритм поиска оптимальных параметров бурения САУБ"},
|
|
||||||
//Spin master - id подсистем с 65_536 до 131_071
|
//Spin master - id подсистем с 65_536 до 131_071
|
||||||
new () {Id = 65536, Name = "Осцилляция", Description = "Осцилляция"},
|
new () {Id = 65536, Name = "Осцилляция", Description = "Осцилляция"},
|
||||||
new () {Id = 65537, Name = "Демпфер", Description = "Демпфер"}
|
new () {Id = 65537, Name = "Демпфер", Description = "Демпфер"}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AsbCloudDb.Model.GTR;
|
using AsbCloudDb.Model.GTR;
|
||||||
using AsbCloudDb.Model.Subsystems;
|
|
||||||
using AsbCloudDb.Model.WITS;
|
using AsbCloudDb.Model.WITS;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
@ -40,7 +39,6 @@ namespace AsbCloudDb.Model
|
|||||||
DbSet<RelationContactWell> RelationContactsWells { get; }
|
DbSet<RelationContactWell> RelationContactsWells { get; }
|
||||||
DbSet<ReportProperty> ReportProperties { get; }
|
DbSet<ReportProperty> ReportProperties { get; }
|
||||||
DbSet<Subsystem> Subsystems { get; }
|
DbSet<Subsystem> Subsystems { get; }
|
||||||
DbSet<SubsystemOperationTime> SubsystemOperationTimes { get; }
|
|
||||||
DbSet<Telemetry> Telemetries { get; }
|
DbSet<Telemetry> Telemetries { get; }
|
||||||
DbSet<TelemetryDataSaub> TelemetryDataSaub { get; }
|
DbSet<TelemetryDataSaub> TelemetryDataSaub { get; }
|
||||||
DbSet<TelemetryDataSaubStat> TelemetryDataSaubStats { get; }
|
DbSet<TelemetryDataSaubStat> TelemetryDataSaubStats { get; }
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace AsbCloudDb.Model.Subsystems
|
namespace AsbCloudDb.Model
|
||||||
{
|
{
|
||||||
[Table("t_subsystem"), Comment("Описание подсистем")]
|
[Table("t_subsystem"), Comment("Описание подсистем")]
|
||||||
public class Subsystem : IId
|
public class Subsystem : IId
|
@ -1,41 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace AsbCloudDb.Model.Subsystems
|
|
||||||
{
|
|
||||||
[Table("t_subsystem_operation_time"), Comment("наработки подсистем")]
|
|
||||||
public partial class SubsystemOperationTime : IId
|
|
||||||
{
|
|
||||||
[Column("id"), Key]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[Column("id_telemetry"), Comment("ИД телеметрии по которой выдается информация")]
|
|
||||||
public int IdTelemetry { get; set; }
|
|
||||||
|
|
||||||
[Column("id_subsystem")]
|
|
||||||
public int IdSubsystem { get; set; }
|
|
||||||
|
|
||||||
[Column("date_start"), Comment("дата/время включения подсистемы")]
|
|
||||||
public DateTimeOffset DateStart { get; set; }
|
|
||||||
|
|
||||||
[Column("date_end"), Comment("дата/время выключения подсистемы")]
|
|
||||||
public DateTimeOffset DateEnd { get; set; }
|
|
||||||
|
|
||||||
[Column("depth_start"), Comment("глубина забоя на момент включения подсистемы")]
|
|
||||||
public float? DepthStart { get; set; }
|
|
||||||
|
|
||||||
[Column("depth_end"), Comment("глубина забоя на момент выключения подсистемы")]
|
|
||||||
public float? DepthEnd { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ForeignKey(nameof(IdSubsystem))]
|
|
||||||
public virtual Subsystem Subsystem { get; set; } = null!;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[ForeignKey(nameof(IdTelemetry))]
|
|
||||||
public virtual Telemetry Telemetry { get; set; } = null!;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user