forked from ddrilling/AsbCloudServer
Add model WellComposite
This commit is contained in:
parent
97df21c58b
commit
e05c291b2b
11
AsbCloudApp/Data/WellCompositeDto.cs
Normal file
11
AsbCloudApp/Data/WellCompositeDto.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class WellCompositeDto
|
||||
{
|
||||
public int IdWell { get; set; }
|
||||
|
||||
public int IdWellSrc { get; set; }
|
||||
|
||||
public int IdWellSectionType { get; set; }
|
||||
}
|
||||
}
|
2585
AsbCloudDb/Migrations/20211012043133_Add_CompositeWell.Designer.cs
generated
Normal file
2585
AsbCloudDb/Migrations/20211012043133_Add_CompositeWell.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
54
AsbCloudDb/Migrations/20211012043133_Add_CompositeWell.cs
Normal file
54
AsbCloudDb/Migrations/20211012043133_Add_CompositeWell.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Add_CompositeWell : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_сomposite_well",
|
||||
columns: table => new
|
||||
{
|
||||
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
|
||||
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
|
||||
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита"),
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
|
||||
table.ForeignKey(
|
||||
name: "t_сomposite_well_src_t_well_id_fk",
|
||||
column: x => x.id_well_src,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "t_сomposite_well_t_well_id_fk",
|
||||
column: x => x.id_well,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "t_сomposite_well_t_well_section_type_id_fk",
|
||||
column: x => x.id_well_src,
|
||||
principalTable: "t_well_section_type",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Композитная скважина");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_сomposite_well_id_well_src",
|
||||
table: "t_сomposite_well",
|
||||
column: "id_well_src");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_сomposite_well");
|
||||
}
|
||||
}
|
||||
}
|
2582
AsbCloudDb/Migrations/20211012044236_Remove_CompositeWell_id.Designer.cs
generated
Normal file
2582
AsbCloudDb/Migrations/20211012044236_Remove_CompositeWell_id.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Remove_CompositeWell_id : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Id",
|
||||
table: "t_сomposite_well");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Id",
|
||||
table: "t_сomposite_well",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
2582
AsbCloudDb/Migrations/20211012053725_Rename_CompositeWell_to_WellComposite.Designer.cs
generated
Normal file
2582
AsbCloudDb/Migrations/20211012053725_Rename_CompositeWell_to_WellComposite.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,93 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Rename_CompositeWell_to_WellComposite : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_сomposite_well");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_well_сomposite",
|
||||
columns: table => new
|
||||
{
|
||||
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
|
||||
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
|
||||
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_well_сomposite", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
|
||||
table.ForeignKey(
|
||||
name: "t_well_сomposite_src_t_well_id_fk",
|
||||
column: x => x.id_well_src,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "t_well_сomposite_t_well_id_fk",
|
||||
column: x => x.id_well,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "t_well_сomposite_t_well_section_type_id_fk",
|
||||
column: x => x.id_well_src,
|
||||
principalTable: "t_well_section_type",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Композитная скважина");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_well_сomposite_id_well_src",
|
||||
table: "t_well_сomposite",
|
||||
column: "id_well_src");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_well_сomposite");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_сomposite_well",
|
||||
columns: table => new
|
||||
{
|
||||
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
|
||||
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
|
||||
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
|
||||
table.ForeignKey(
|
||||
name: "t_сomposite_well_src_t_well_id_fk",
|
||||
column: x => x.id_well_src,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "t_сomposite_well_t_well_id_fk",
|
||||
column: x => x.id_well,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "t_сomposite_well_t_well_section_type_id_fk",
|
||||
column: x => x.id_well_src,
|
||||
principalTable: "t_well_section_type",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "Композитная скважина");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_сomposite_well_id_well_src",
|
||||
table: "t_сomposite_well",
|
||||
column: "id_well_src");
|
||||
}
|
||||
}
|
||||
}
|
@ -1572,6 +1572,33 @@ namespace AsbCloudDb.Migrations
|
||||
.HasComment("скважины");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b =>
|
||||
{
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("Id скважины получателя");
|
||||
|
||||
b.Property<int>("IdWellSrc")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well_src")
|
||||
.HasComment("Id скважины композита");
|
||||
|
||||
b.Property<int>("IdWellSectionType")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well_section_type")
|
||||
.HasComment("Id тип секции композита");
|
||||
|
||||
b.HasKey("IdWell", "IdWellSrc", "IdWellSectionType");
|
||||
|
||||
b.HasIndex("IdWellSrc");
|
||||
|
||||
b.ToTable("t_well_сomposite");
|
||||
|
||||
b
|
||||
.HasComment("Композитная скважина");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -2407,6 +2434,36 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("WellType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany("WellComposites")
|
||||
.HasForeignKey("IdWell")
|
||||
.HasConstraintName("t_well_сomposite_t_well_id_fk")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "WellSrc")
|
||||
.WithMany("WellCompositeSrcs")
|
||||
.HasForeignKey("IdWellSrc")
|
||||
.HasConstraintName("t_well_сomposite_src_t_well_id_fk")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
|
||||
.WithMany("WellComposites")
|
||||
.HasForeignKey("IdWellSrc")
|
||||
.HasConstraintName("t_well_сomposite_t_well_section_type_id_fk")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Well");
|
||||
|
||||
b.Navigation("WellSectionType");
|
||||
|
||||
b.Navigation("WellSrc");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory")
|
||||
@ -2492,6 +2549,10 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
b.Navigation("RelationCompaniesWells");
|
||||
|
||||
b.Navigation("WellComposites");
|
||||
|
||||
b.Navigation("WellCompositeSrcs");
|
||||
|
||||
b.Navigation("WellOperations");
|
||||
});
|
||||
|
||||
@ -2504,6 +2565,8 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
b.Navigation("DrillParamsCollection");
|
||||
|
||||
b.Navigation("WellComposites");
|
||||
|
||||
b.Navigation("WellOperations");
|
||||
});
|
||||
|
||||
|
@ -14,6 +14,7 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
public virtual DbSet<Cluster> Clusters { get; set; }
|
||||
public virtual DbSet<Company> Companies { get; set; }
|
||||
public virtual DbSet<WellComposite> WellComposites { get; set; }
|
||||
public virtual DbSet<Deposit> Deposits { get; set; }
|
||||
public virtual DbSet<FileCategory> FileCategories { get; set; }
|
||||
public virtual DbSet<FileInfo> Files { get; set; }
|
||||
@ -71,6 +72,29 @@ namespace AsbCloudDb.Model
|
||||
.HasConstraintName("t_cluster_t_deposit_id_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WellComposite>(entity =>
|
||||
{
|
||||
entity.HasKey(
|
||||
nameof(WellComposite.IdWell),
|
||||
nameof(WellComposite.IdWellSrc),
|
||||
nameof(WellComposite.IdWellSectionType));
|
||||
|
||||
entity.HasOne(d => d.Well)
|
||||
.WithMany(p => p.WellComposites)
|
||||
.HasForeignKey(d => d.IdWell)
|
||||
.HasConstraintName("t_well_сomposite_t_well_id_fk");
|
||||
|
||||
entity.HasOne(d => d.WellSrc)
|
||||
.WithMany(p => p.WellCompositeSrcs)
|
||||
.HasForeignKey(d => d.IdWellSrc)
|
||||
.HasConstraintName("t_well_сomposite_src_t_well_id_fk");
|
||||
|
||||
entity.HasOne(d => d.WellSectionType)
|
||||
.WithMany(p => p.WellComposites)
|
||||
.HasForeignKey(d => d.IdWellSrc)
|
||||
.HasConstraintName("t_well_сomposite_t_well_section_type_id_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TelemetryDataSaub>(entity =>
|
||||
{
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
|
@ -16,7 +16,6 @@ namespace AsbCloudDb.Model
|
||||
[Column("id_telemetry")]
|
||||
public int IdTelemetry { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(IdTelemetry))]
|
||||
[InverseProperty(nameof(Model.Telemetry.Users))]
|
||||
@ -37,7 +36,6 @@ namespace AsbCloudDb.Model
|
||||
[Column("level")]
|
||||
public int? Level { get; set; }
|
||||
|
||||
|
||||
public string MakeDisplayName()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Surname))
|
||||
|
@ -20,7 +20,6 @@ namespace AsbCloudDb.Model
|
||||
[Column("id_role")]
|
||||
public int? IdRole { get; set; }
|
||||
|
||||
|
||||
[Column("login")]
|
||||
[StringLength(255)]
|
||||
public string Login { get; set; }
|
||||
|
@ -52,5 +52,11 @@ namespace AsbCloudDb.Model
|
||||
[JsonIgnore]
|
||||
[InverseProperty(nameof(WellOperation.Well))]
|
||||
public virtual ICollection<WellOperation> WellOperations { get; set; }
|
||||
|
||||
[InverseProperty(nameof(WellComposite.Well))]
|
||||
public virtual ICollection<WellComposite> WellComposites { get; set; }
|
||||
|
||||
[InverseProperty(nameof(WellComposite.WellSrc))]
|
||||
public virtual ICollection<WellComposite> WellCompositeSrcs { get; set; }
|
||||
}
|
||||
}
|
||||
|
32
AsbCloudDb/Model/WellComposite.cs
Normal file
32
AsbCloudDb/Model/WellComposite.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
[Table("t_well_сomposite"), Comment("Композитная скважина")]
|
||||
public class WellComposite : IIdWell
|
||||
{
|
||||
[Column("id_well"), Comment("Id скважины получателя")]
|
||||
public int IdWell { get; set; }
|
||||
|
||||
[Column("id_well_src"), Comment("Id скважины композита")]
|
||||
public int IdWellSrc { get; set; }
|
||||
|
||||
[Column("id_well_section_type"), Comment("Id тип секции композита")]
|
||||
public int IdWellSectionType { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdWell))]
|
||||
[InverseProperty(nameof(Model.Well.WellComposites))]
|
||||
public virtual Well Well { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdWellSrc))]
|
||||
[InverseProperty(nameof(Model.Well.WellCompositeSrcs))]
|
||||
public virtual Well WellSrc { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdWellSectionType))]
|
||||
[InverseProperty(nameof(Model.WellSectionType.WellComposites))]
|
||||
public virtual WellSectionType WellSectionType { get; set; }
|
||||
}
|
||||
}
|
@ -25,5 +25,9 @@ namespace AsbCloudDb.Model
|
||||
[JsonIgnore]
|
||||
[InverseProperty(nameof(DrillParams.WellSectionType))]
|
||||
public virtual ICollection<DrillParams> DrillParamsCollection { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[InverseProperty(nameof(WellComposite.WellSectionType))]
|
||||
public virtual ICollection<WellComposite> WellComposites { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user