Изменение модели

1. Добавил новую сущность
2. Поправил DbContext
3. Добавил новую миграцию
This commit is contained in:
parent e15b58228b
commit 1d144954ba
6 changed files with 8850 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_ProcessMapWellboreDevelopment : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_process_map_wellbore_development",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
last_update = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата последнего изменения"),
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Стартовая глубина"),
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Окончательная глубина"),
repeats = table.Column<double>(type: "double precision", nullable: false, comment: "Количество повторений"),
spin_upward = table.Column<double>(type: "double precision", nullable: false, comment: "Вращение при движении вверх, об/мин"),
spin_downward = table.Column<double>(type: "double precision", nullable: false, comment: "Вращение при движении вниз, об/мин"),
speed_upward = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость подъёма, м/ч"),
speed_downward = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость спуска, м/ч"),
setpoint_drags = table.Column<double>(type: "double precision", nullable: false, comment: "Уставка зятяжки, т"),
setpoint_tights = table.Column<double>(type: "double precision", nullable: false, comment: "Уставка посадки, т"),
pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Давление"),
torque = table.Column<double>(type: "double precision", nullable: false, comment: "Момент, кН м"),
comment = table.Column<string>(type: "text", nullable: true, comment: "Комментарий")
},
constraints: table =>
{
table.PrimaryKey("PK_t_process_map_wellbore_development", x => x.id);
table.ForeignKey(
name: "FK_t_process_map_wellbore_development_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Проработка скважины");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_wellbore_development_id_well",
table: "t_process_map_wellbore_development",
column: "id_well");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_process_map_wellbore_development");
}
}
}

View File

@ -2467,6 +2467,94 @@ namespace AsbCloudDb.Migrations
b.HasComment("Операции по скважине РТК");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMapWellboreDevelopment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Comment")
.HasColumnType("text")
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<double>("DepthEnd")
.HasColumnType("double precision")
.HasColumnName("depth_end")
.HasComment("Окончательная глубина");
b.Property<double>("DepthStart")
.HasColumnType("double precision")
.HasColumnName("depth_start")
.HasComment("Стартовая глубина");
b.Property<int>("IdWell")
.HasColumnType("integer")
.HasColumnName("id_well")
.HasComment("Id скважины");
b.Property<DateTimeOffset>("LastUpdate")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_update")
.HasComment("Дата последнего изменения");
b.Property<double>("Pressure")
.HasColumnType("double precision")
.HasColumnName("pressure")
.HasComment("Давление");
b.Property<double>("Repeats")
.HasColumnType("double precision")
.HasColumnName("repeats")
.HasComment("Количество повторений");
b.Property<double>("SetpointDrags")
.HasColumnType("double precision")
.HasColumnName("setpoint_drags")
.HasComment("Уставка зятяжки, т");
b.Property<double>("SetpointTights")
.HasColumnType("double precision")
.HasColumnName("setpoint_tights")
.HasComment("Уставка посадки, т");
b.Property<double>("SpeedDownward")
.HasColumnType("double precision")
.HasColumnName("speed_downward")
.HasComment("Скорость спуска, м/ч");
b.Property<double>("SpeedUpward")
.HasColumnType("double precision")
.HasColumnName("speed_upward")
.HasComment("Скорость подъёма, м/ч");
b.Property<double>("SpinDownward")
.HasColumnType("double precision")
.HasColumnName("spin_downward")
.HasComment("Вращение при движении вниз, об/мин");
b.Property<double>("SpinUpward")
.HasColumnType("double precision")
.HasColumnName("spin_upward")
.HasComment("Вращение при движении вверх, об/мин");
b.Property<double>("Torque")
.HasColumnType("double precision")
.HasColumnName("torque")
.HasComment("Момент, кН м");
b.HasKey("Id");
b.HasIndex("IdWell");
b.ToTable("t_process_map_wellbore_development");
b.HasComment("Проработка скважины");
});
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
{
b.Property<int>("IdCompany")
@ -7912,6 +8000,17 @@ namespace AsbCloudDb.Migrations
b.Navigation("WellSectionType");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMapWellboreDevelopment", b =>
{
b.HasOne("AsbCloudDb.Model.Well", "Well")
.WithMany()
.HasForeignKey("IdWell")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Well");
});
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
{
b.HasOne("AsbCloudDb.Model.Company", "Company")

View File

@ -17,6 +17,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
public virtual DbSet<PlannedTrajectory> PlannedTrajectories => Set<PlannedTrajectory>();
public virtual DbSet<ProcessMap> ProcessMap => Set<ProcessMap>();
public virtual DbSet<ProcessMapWellboreDevelopment> ProcessMapWellboreDevelopments => Set<ProcessMapWellboreDevelopment>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();

View File

@ -21,6 +21,7 @@ namespace AsbCloudDb.Model
DbSet<DetectedOperation> DetectedOperations { get; }
DbSet<PlannedTrajectory> PlannedTrajectories { get; }
DbSet<ProcessMap> ProcessMap { get; }
DbSet<ProcessMapWellboreDevelopment> ProcessMapWellboreDevelopments { get; }
DbSet<DrillingProgramPart> DrillingProgramParts { get; }
DbSet<FileCategory> FileCategories { get; }
DbSet<FileInfo> Files { get; }

View File

@ -0,0 +1,59 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model;
[Table("t_process_map_wellbore_development"), Comment("Проработка скважины")]
public class ProcessMapWellboreDevelopment : IId, IWellRelated
{
[Key]
[Column("id")]
public int Id { get; set; }
[Column("id_well"), Comment("Id скважины")]
public int IdWell { get; set; }
[Column("last_update", TypeName = "timestamp with time zone"), Comment("Дата последнего изменения")]
public DateTimeOffset LastUpdate { get; set; }
[Column("depth_start"), Comment("Стартовая глубина")]
public double DepthStart { get; set; }
[Column("depth_end"), Comment("Окончательная глубина")]
public double DepthEnd { get; set; }
[Column("repeats"), Comment("Количество повторений")]
public double Repeats { get; set; }
[Column("spin_upward"), Comment("Вращение при движении вверх, об/мин")]
public double SpinUpward { get; set; }
[Column("spin_downward"), Comment("Вращение при движении вниз, об/мин")]
public double SpinDownward { get; set; }
[Column("speed_upward"), Comment("Скорость подъёма, м/ч")]
public double SpeedUpward { get; set; }
[Column("speed_downward"), Comment("Скорость спуска, м/ч")]
public double SpeedDownward { get; set; }
[Column("setpoint_drags"), Comment("Уставка зятяжки, т")]
public double SetpointDrags { get; set; }
[Column("setpoint_tights"), Comment("Уставка посадки, т")]
public double SetpointTights { get; set; }
[Column("pressure"), Comment("Давление")]
public double Pressure { get; set; }
[Column("torque"), Comment("Момент, кН м")]
public double Torque { get; set; }
[Column("comment"), Comment("Комментарий")]
public string? Comment { get; set; }
[ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; } = null!;
}