forked from ddrilling/AsbCloudServer
Add migration. Set Telemetry forign keys on delete - cascade.
This commit is contained in:
parent
098e8743b0
commit
031ff8c747
2371
AsbCloudDb/Migrations/20211001121146_Set_Telemetry_FKs_OnDelete_Cascade.Designer.cs
generated
Normal file
2371
AsbCloudDb/Migrations/20211001121146_Set_Telemetry_FKs_OnDelete_Cascade.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,133 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Set_Telemetry_FKs_OnDelete_Cascade : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_telemetry_data_saub_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_saub");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_telemetry_data_spin_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_spin");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_telemetry_user_t_telemetry_id_fk",
|
||||
table: "t_telemetry_user");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_user_t_company_id_fk",
|
||||
table: "t_user");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_well_t_telemetry_id_fk",
|
||||
table: "t_well");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_data_saub_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_saub",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_data_spin_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_spin",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_user_t_telemetry_id_fk",
|
||||
table: "t_telemetry_user",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_user_t_company_id_fk",
|
||||
table: "t_user",
|
||||
column: "id_company",
|
||||
principalTable: "t_company",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_well_t_telemetry_id_fk",
|
||||
table: "t_well",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_telemetry_data_saub_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_saub");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_telemetry_data_spin_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_spin");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_telemetry_user_t_telemetry_id_fk",
|
||||
table: "t_telemetry_user");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_user_t_company_id_fk",
|
||||
table: "t_user");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "t_well_t_telemetry_id_fk",
|
||||
table: "t_well");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_data_saub_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_saub",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_data_spin_t_telemetry_id_fk",
|
||||
table: "t_telemetry_data_spin",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_telemetry_user_t_telemetry_id_fk",
|
||||
table: "t_telemetry_user",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_user_t_company_id_fk",
|
||||
table: "t_user",
|
||||
column: "id_company",
|
||||
principalTable: "t_company",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "t_well_t_telemetry_id_fk",
|
||||
table: "t_well",
|
||||
column: "id_telemetry",
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
@ -17,10 +17,10 @@ namespace AsbCloudDb.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasPostgresExtension("adminpack")
|
||||
.UseIdentityByDefaultColumns()
|
||||
.HasAnnotation("Relational:Collation", "Russian_Russia.1251")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63)
|
||||
.HasAnnotation("ProductVersion", "5.0.2");
|
||||
.HasAnnotation("ProductVersion", "5.0.10")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
|
||||
{
|
||||
@ -28,7 +28,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -64,7 +64,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -98,7 +98,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -133,7 +133,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -162,7 +162,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text")
|
||||
@ -274,7 +274,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("IdAuthor")
|
||||
.HasColumnType("integer")
|
||||
@ -330,7 +330,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<Dictionary<string, object>>("Data")
|
||||
.HasColumnType("jsonb")
|
||||
@ -375,7 +375,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text")
|
||||
@ -441,7 +441,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<DateTimeOffset>("Begin")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
@ -490,7 +490,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<TelemetryInfo>("Info")
|
||||
.HasColumnType("jsonb")
|
||||
@ -518,7 +518,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("DurationSec")
|
||||
.HasColumnType("integer")
|
||||
@ -578,12 +578,12 @@ namespace AsbCloudDb.Migrations
|
||||
.HasColumnName("is_pressure_lt_20")
|
||||
.HasComment("Давление менее 20");
|
||||
|
||||
b.Property<bool>("IsRotorSpeedGt3")
|
||||
b.Property<bool>("IsRotorSpeedGt5")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_rotor_speed_gt_3")
|
||||
.HasComment("Обороты ротора выше 3");
|
||||
|
||||
b.Property<bool>("IsRotorSpeedLt3")
|
||||
b.Property<bool>("IsRotorSpeedLt5")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_rotor_speed_lt_3")
|
||||
.HasComment("Обороты ротора ниже 3");
|
||||
@ -631,7 +631,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<double?>("AxialLoad")
|
||||
.HasColumnType("double precision")
|
||||
@ -838,7 +838,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<double?>("BreakAngleK")
|
||||
.HasColumnType("double precision")
|
||||
@ -1185,7 +1185,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Arg0")
|
||||
.HasMaxLength(255)
|
||||
@ -1282,7 +1282,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(255)
|
||||
@ -1381,7 +1381,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -1415,7 +1415,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -1463,7 +1463,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("CategoryInfo")
|
||||
.HasColumnType("text")
|
||||
@ -1534,7 +1534,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("Code")
|
||||
.HasColumnType("integer")
|
||||
@ -1952,7 +1952,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -2006,7 +2006,7 @@ namespace AsbCloudDb.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id")
|
||||
.UseIdentityByDefaultColumn();
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Caption")
|
||||
.HasMaxLength(255)
|
||||
@ -2166,6 +2166,7 @@ namespace AsbCloudDb.Migrations
|
||||
.WithMany("DataSaub")
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
@ -2177,6 +2178,7 @@ namespace AsbCloudDb.Migrations
|
||||
.WithMany("DataSpin")
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
@ -2212,6 +2214,7 @@ namespace AsbCloudDb.Migrations
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.HasConstraintName("t_telemetry_user_t_telemetry_id_fk")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
@ -2222,7 +2225,8 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasOne("AsbCloudDb.Model.Company", "Company")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("IdCompany")
|
||||
.HasConstraintName("t_user_t_company_id_fk");
|
||||
.HasConstraintName("t_user_t_company_id_fk")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.UserRole", "Role")
|
||||
.WithMany("Users")
|
||||
@ -2243,7 +2247,8 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithOne("Well")
|
||||
.HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry")
|
||||
.HasConstraintName("t_well_t_telemetry_id_fk");
|
||||
.HasConstraintName("t_well_t_telemetry_id_fk")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.WellType", "WellType")
|
||||
.WithMany("Wells")
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -76,7 +75,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.DataSaub)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
@ -85,7 +84,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.DataSpin)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
@ -94,6 +93,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.Messages)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("t_messages_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
@ -103,7 +103,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.Users)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("t_telemetry_user_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
@ -112,6 +112,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.Analysis)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("t_analysis_t_telemetry_id_fk");
|
||||
|
||||
entity.HasOne(d => d.Operation)
|
||||
@ -127,6 +128,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithMany(p => p.Events)
|
||||
.HasForeignKey(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("t_event_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
@ -135,6 +137,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Company)
|
||||
.WithMany(p => p.Users)
|
||||
.HasForeignKey(d => d.IdCompany)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("t_user_t_company_id_fk");
|
||||
|
||||
entity.HasIndex(d => d.Login)
|
||||
@ -151,12 +154,12 @@ namespace AsbCloudDb.Model
|
||||
entity.HasOne(d => d.Telemetry)
|
||||
.WithOne(p => p.Well)
|
||||
.HasForeignKey<Well>(d => d.IdTelemetry)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("t_well_t_telemetry_id_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<RelationCompanyWell>(entity =>
|
||||
{
|
||||
|
||||
entity.HasKey(nameof(RelationCompanyWell.IdCompany), nameof(RelationCompanyWell.IdWell));
|
||||
|
||||
entity.HasOne(r => r.Well)
|
||||
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
@ -229,11 +230,11 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
transaction.Commit();
|
||||
sw.Stop();
|
||||
Console.WriteLine($"Successfully commited in {1d*sw.ElapsedMilliseconds/1000d: #0.00} sec.");
|
||||
Console.WriteLine($"Successfully commited in {1d*sw.ElapsedMilliseconds/1000d: #0.00} sec. Affected {rows} rows.");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Fail. Rollback.");
|
||||
Console.WriteLine($"Fail. Rollback. Reason is:{ex.Message}");
|
||||
transaction.Rollback();
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ namespace AsbCloudWebApi
|
||||
{
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
//c.CustomOperationIds(e => $"{e.ActionDescriptor.RouteValues["controller"]}_{e.HttpMethod}");
|
||||
//c.CustomOperationIds(e => $"{e.HttpMethod}_{e.ActionDescriptor.Ac");
|
||||
c.CustomOperationIds(e =>
|
||||
{
|
||||
return $"{e.ActionDescriptor.RouteValues["action"]}";
|
||||
|
Loading…
Reference in New Issue
Block a user