using System;
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<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Время начала"),
                    depthStart = table.Column<float>(type: "real", nullable: false, comment: "Глубина начала"),
                    t_drill_test_params = table.Column<string>(type: "jsonb", nullable: false, comment: "Параметры записи drill test")
                },
                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.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");
        }
    }
}