DD.WellWorkover.Cloud/AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.cs

73 lines
3.7 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Drill_Test : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_drill_test",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор"),
id_telemetry = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор телеметрии"),
timestamp_start = table.Column<int>(type: "integer", nullable: false, comment: "Время начала"),
depthStart = table.Column<float>(type: "real", nullable: true, comment: "Глубина начала")
},
constraints: table =>
{
table.PrimaryKey("PK_t_drill_test", x => new { x.id, x.id_telemetry });
table.ForeignKey(
name: "FK_t_drill_test_t_telemetry_id_telemetry",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Drill_test");
migrationBuilder.CreateTable(
name: "t_drill_test_parameter",
columns: table => new
{
id_drill_test = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор drill test"),
id_telemetry_drill_test = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор телеметрии drill test"),
step = table.Column<int>(type: "integer", nullable: false, comment: "Шаг"),
workload = table.Column<float>(type: "real", nullable: true, comment: "Нагрузка"),
speed = table.Column<float>(type: "real", nullable: true, comment: "Заданная скорость"),
depth_speed = table.Column<float>(type: "real", nullable: true, comment: "Скорость проходки"),
time_drill_step = table.Column<float>(type: "real", nullable: true, comment: "Время бурения шага"),
depth_drill_step = table.Column<float>(type: "real", nullable: true, comment: "Глубина бурения шага")
},
constraints: table =>
{
table.PrimaryKey("PK_t_drill_test_parameter", x => new { x.id_drill_test, x.id_telemetry_drill_test });
table.ForeignKey(
name: "FK_t_drill_test_parameter_t_drill_test_id_drill_test_id_teleme~",
columns: x => new { x.id_drill_test, x.id_telemetry_drill_test },
principalTable: "t_drill_test",
principalColumns: new[] { "id", "id_telemetry" },
onDelete: ReferentialAction.Cascade);
},
comment: "Drill_test_parameter");
migrationBuilder.CreateIndex(
name: "IX_t_drill_test_id_telemetry",
table: "t_drill_test",
column: "id_telemetry");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_drill_test_parameter");
migrationBuilder.DropTable(
name: "t_drill_test");
}
}
}