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

1. Добавлена новая сущность
2. Добавлена миграция
This commit is contained in:
Степанов Дмитрий 2024-08-20 14:08:10 +05:00
parent d416d77573
commit 2e7af2a8da
7 changed files with 12655 additions and 2 deletions

View File

@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РКТ план использование подсистем
/// </summary>
public class ProcessMapPlanSubsystemsDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Использование ротора
/// </summary>
[Range(0.0, 100)]
[Required(ErrorMessage = "Процент использования ротора, должен быть в пределах от 0 до 100")]
public double AutoRotor { get; set; }
/// <summary>
/// Использование слайда
/// </summary>
[Range(0.0, 100)]
[Required(ErrorMessage = "Процент использования слайда, должен быть в пределах от 0 до 100")]
public double AutoSlide { get; set; }
/// <summary>
/// Использование слайда с осцилляцией
/// </summary>
[Range(0.0, 100)]
[Required(ErrorMessage = "Процент использования слайда с осцилляцией, должен быть в пределах от 0 до 100")]
public double AutoOscillation { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string? Note { get; set; }
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,93 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
/// <inheritdoc />
public partial class Add_ProcessMapPlanSubsystems : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_process_map_plan_subsystems",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
auto_rotor = table.Column<double>(type: "double precision", nullable: false, comment: "Процент использования ротора"),
auto_slide = table.Column<double>(type: "double precision", nullable: false, comment: "Процент использования слайда"),
auto_oscillation = table.Column<double>(type: "double precision", nullable: false, comment: "Процент использования слайда с осцилляцией"),
note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true, comment: "Примечание"),
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
id_wellsection_type = table.Column<int>(type: "integer", 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: "Глубина по стволу до, м")
},
constraints: table =>
{
table.PrimaryKey("PK_t_process_map_plan_subsystems", x => x.id);
table.ForeignKey(
name: "FK_t_process_map_plan_subsystems_t_user_id_author",
column: x => x.id_author,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_process_map_plan_subsystems_t_user_id_editor",
column: x => x.id_editor,
principalTable: "t_user",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_process_map_plan_subsystems_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_process_map_plan_subsystems_t_well_section_type_id_wellse~",
column: x => x.id_wellsection_type,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "РТК план использование подсистем");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_subsystems_id_author",
table: "t_process_map_plan_subsystems",
column: "id_author");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_subsystems_id_editor",
table: "t_process_map_plan_subsystems",
column: "id_editor");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_subsystems_id_well",
table: "t_process_map_plan_subsystems",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_subsystems_id_wellsection_type",
table: "t_process_map_plan_subsystems",
column: "id_wellsection_type");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_process_map_plan_subsystems");
}
}
}

View File

@ -19,7 +19,7 @@ namespace AsbCloudDb.Migrations
#pragma warning disable 612, 618
modelBuilder
.UseCollation("Russian_Russia.1251")
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
@ -4892,6 +4892,103 @@ namespace AsbCloudDb.Migrations
});
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.ProcessMapPlanSubsystems", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasComment("Идентификатор");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("AutoOscillation")
.HasColumnType("double precision")
.HasColumnName("auto_oscillation")
.HasComment("Процент использования слайда с осцилляцией");
b.Property<double>("AutoRotor")
.HasColumnType("double precision")
.HasColumnName("auto_rotor")
.HasComment("Процент использования ротора");
b.Property<double>("AutoSlide")
.HasColumnType("double precision")
.HasColumnName("auto_slide")
.HasComment("Процент использования слайда");
b.Property<DateTimeOffset>("Creation")
.HasColumnType("timestamp with time zone")
.HasColumnName("creation")
.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>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
.HasComment("Автор");
b.Property<int?>("IdEditor")
.HasColumnType("integer")
.HasColumnName("id_editor")
.HasComment("Редактор");
b.Property<int?>("IdPrevious")
.HasColumnType("integer")
.HasColumnName("id_previous")
.HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная");
b.Property<int>("IdState")
.HasColumnType("integer")
.HasColumnName("id_state")
.HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная");
b.Property<int>("IdWell")
.HasColumnType("integer")
.HasColumnName("id_well")
.HasComment("Id скважины");
b.Property<int>("IdWellSectionType")
.HasColumnType("integer")
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<string>("Note")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
.HasComment("Примечание");
b.Property<DateTimeOffset?>("Obsolete")
.HasColumnType("timestamp with time zone")
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.HasKey("Id");
b.HasIndex("IdAuthor");
b.HasIndex("IdEditor");
b.HasIndex("IdWell");
b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map_plan_subsystems", t =>
{
t.HasComment("РТК план использование подсистем");
});
});
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
{
b.Property<int>("IdCompany")
@ -11573,6 +11670,39 @@ namespace AsbCloudDb.Migrations
b.Navigation("WellSectionType");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.ProcessMapPlanSubsystems", b =>
{
b.HasOne("AsbCloudDb.Model.User", "Author")
.WithMany()
.HasForeignKey("IdAuthor")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AsbCloudDb.Model.User", "Editor")
.WithMany()
.HasForeignKey("IdEditor");
b.HasOne("AsbCloudDb.Model.Well", "Well")
.WithMany()
.HasForeignKey("IdWell")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
.WithMany()
.HasForeignKey("IdWellSectionType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Editor");
b.Navigation("Well");
b.Navigation("WellSectionType");
});
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
{
b.HasOne("AsbCloudDb.Model.Company", "Company")

View File

@ -4,6 +4,7 @@ using System.Threading;
using System.Threading.Tasks;
using AsbCloudDb.Model.DailyReports;
using AsbCloudDb.Model.Manuals;
using AsbCloudDb.Model.ProcessMapPlan;
using AsbCloudDb.Model.WellSections;
using AsbCloudDb.Model.Trajectory;
using AsbCloudDb.Model.ProcessMapPlan.Functions;
@ -38,6 +39,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanOscillation> ProcessMapPlanOscillation => Set<ProcessMapPlanOscillation>();
public virtual DbSet<ProcessMapPlanAntiCrashRotation> ProcessMapPlanAntiCrashRotation => Set<ProcessMapPlanAntiCrashRotation>();
public virtual DbSet<ProcessMapPlanStaticMeasurementOutput> ProcessMapPlanStaticMeasurementOutput => Set<ProcessMapPlanStaticMeasurementOutput>();
public virtual DbSet<ProcessMapPlanSubsystems> ProcessMapPlanSubsystems => Set<ProcessMapPlanSubsystems>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();

View File

@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using AsbCloudDb.Model.DailyReports;
using AsbCloudDb.Model.Manuals;
using AsbCloudDb.Model.ProcessMapPlan;
using AsbCloudDb.Model.WellSections;
using AsbCloudDb.Model.Trajectory;
using AsbCloudDb.Model.ProcessMapPlan.Functions;
@ -99,6 +100,7 @@ namespace AsbCloudDb.Model
DbSet<ProcessMapPlanOscillation> ProcessMapPlanOscillation { get; }
DbSet<ProcessMapPlanAntiCrashRotation> ProcessMapPlanAntiCrashRotation { get; }
DbSet<ProcessMapPlanStaticMeasurementOutput> ProcessMapPlanStaticMeasurementOutput { get; }
DbSet<ProcessMapPlanSubsystems> ProcessMapPlanSubsystems { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;

View File

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.ProcessMapPlan;
[Table("t_process_map_plan_subsystems"), Comment("РТК план использование подсистем")]
public class ProcessMapPlanSubsystems : ProcessMapPlanBase
{
[Range(0.0, 100)]
[Column("auto_rotor"), Comment("Процент использования ротора")]
public double AutoRotor { get; set; }
[Range(0.0, 100)]
[Column("auto_slide"), Comment("Процент использования слайда")]
public double AutoSlide { get; set; }
[Range(0.0, 100)]
[Column("auto_oscillation"), Comment("Процент использования слайда с осцилляцией")]
public double AutoOscillation { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string? Note { get; set; }
}