forked from ddrilling/AsbCloudServer
add migration
This commit is contained in:
parent
4014dd03f6
commit
a53bf11900
7943
AsbCloudDb/Migrations/20230327205436_add_table_wits_gtr.Designer.cs
generated
Normal file
7943
AsbCloudDb/Migrations/20230327205436_add_table_wits_gtr.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
139
AsbCloudDb/Migrations/20230327205436_add_table_wits_gtr.cs
Normal file
139
AsbCloudDb/Migrations/20230327205436_add_table_wits_gtr.cs
Normal file
@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class add_table_wits_gtr : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_base",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_base", x => new { x.id_telemetry, x.id_record, x.id_item });
|
||||
},
|
||||
comment: "таблица данных ГТИ");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_float",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
value = table.Column<float>(type: "real", nullable: true),
|
||||
TelemetryId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_float", x => new { x.id_telemetry, x.id_record, x.id_item });
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_float_t_telemetry_TelemetryId",
|
||||
column: x => x.TelemetryId,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_float_t_wits_base_id_telemetry_id_record_id_item",
|
||||
columns: x => new { x.id_telemetry, x.id_record, x.id_item },
|
||||
principalTable: "t_wits_base",
|
||||
principalColumns: new[] { "id_telemetry", "id_record", "id_item" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "таблица данных ГТИ с типом значения float");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_int",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
Value = table.Column<long>(type: "bigint", nullable: true),
|
||||
TelemetryId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_int", x => new { x.id_telemetry, x.id_record, x.id_item });
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_int_t_telemetry_TelemetryId",
|
||||
column: x => x.TelemetryId,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_int_t_wits_base_id_telemetry_id_record_id_item",
|
||||
columns: x => new { x.id_telemetry, x.id_record, x.id_item },
|
||||
principalTable: "t_wits_base",
|
||||
principalColumns: new[] { "id_telemetry", "id_record", "id_item" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "таблица данных ГТИ с типом значения int16 int32");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_string",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
value = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
TelemetryId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_string", x => new { x.id_telemetry, x.id_record, x.id_item });
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_string_t_telemetry_TelemetryId",
|
||||
column: x => x.TelemetryId,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_string_t_wits_base_id_telemetry_id_record_id_item",
|
||||
columns: x => new { x.id_telemetry, x.id_record, x.id_item },
|
||||
principalTable: "t_wits_base",
|
||||
principalColumns: new[] { "id_telemetry", "id_record", "id_item" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "таблица данных ГТИ с типом значения string");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_wits_float_TelemetryId",
|
||||
table: "t_wits_float",
|
||||
column: "TelemetryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_wits_int_TelemetryId",
|
||||
table: "t_wits_int",
|
||||
column: "TelemetryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_wits_string_TelemetryId",
|
||||
table: "t_wits_string",
|
||||
column: "TelemetryId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_float");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_int");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_string");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_base");
|
||||
}
|
||||
}
|
||||
}
|
@ -801,6 +801,31 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasComment("Действия с файлами.");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsBase", b =>
|
||||
{
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int>("IdRecord")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_record");
|
||||
|
||||
b.Property<int>("IdItem")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_item");
|
||||
|
||||
b.Property<DateTimeOffset>("DateTime")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date");
|
||||
|
||||
b.HasKey("IdTelemetry", "IdRecord", "IdItem");
|
||||
|
||||
b.ToTable("t_wits_base");
|
||||
|
||||
b.HasComment("таблица данных ГТИ");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -6373,6 +6398,61 @@ namespace AsbCloudDb.Migrations
|
||||
b.ToTable("t_telemetry_wits_base");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsFloat", b =>
|
||||
{
|
||||
b.HasBaseType("AsbCloudDb.Model.GTR.WitsBase");
|
||||
|
||||
b.Property<int?>("TelemetryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<float?>("Value")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_wits_float");
|
||||
|
||||
b.HasComment("таблица данных ГТИ с типом значения float");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsInt", b =>
|
||||
{
|
||||
b.HasBaseType("AsbCloudDb.Model.GTR.WitsBase");
|
||||
|
||||
b.Property<int?>("TelemetryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long?>("Value")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("Value");
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_wits_int");
|
||||
|
||||
b.HasComment("таблица данных ГТИ с типом значения int16 int32");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsStr", b =>
|
||||
{
|
||||
b.HasBaseType("AsbCloudDb.Model.GTR.WitsBase");
|
||||
|
||||
b.Property<int?>("TelemetryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_wits_string");
|
||||
|
||||
b.HasComment("таблица данных ГТИ с типом значения string");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
|
||||
{
|
||||
b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase");
|
||||
@ -7614,6 +7694,51 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsFloat", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany()
|
||||
.HasForeignKey("TelemetryId");
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.GTR.WitsBase", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("AsbCloudDb.Model.GTR.WitsFloat", "IdTelemetry", "IdRecord", "IdItem")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsInt", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany()
|
||||
.HasForeignKey("TelemetryId");
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.GTR.WitsBase", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("AsbCloudDb.Model.GTR.WitsInt", "IdTelemetry", "IdRecord", "IdItem")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsStr", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany()
|
||||
.HasForeignKey("TelemetryId");
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.GTR.WitsBase", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("AsbCloudDb.Model.GTR.WitsStr", "IdTelemetry", "IdRecord", "IdItem")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudDb.Model.GTR
|
||||
{
|
||||
[Table("t_wits_int"), Comment("таблица данных ГТИ с типом значения float")]
|
||||
[Table("t_wits_float"), Comment("таблица данных ГТИ с типом значения float")]
|
||||
public class WitsFloat : WitsBase
|
||||
{
|
||||
[Column("value")]
|
||||
|
Loading…
Reference in New Issue
Block a user