using Microsoft.EntityFrameworkCore.Migrations;
using System;

#nullable disable

namespace AsbCloudDb.Migrations
{
    public partial class Add_WitsRecords : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "RecordBase",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    WELLID = table.Column<string>(type: "text", nullable: true),
                    STKNUM = table.Column<short>(type: "smallint", nullable: true),
                    RECID = table.Column<short>(type: "smallint", nullable: true),
                    SEQID = table.Column<int>(type: "integer", nullable: true),
                    DATE = table.Column<int>(type: "integer", nullable: true),
                    TIME = table.Column<int>(type: "integer", nullable: true),
                    ACTCOD = table.Column<short>(type: "smallint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RecordBase", x => new { x.id_telemetry, x.date });
                });

            migrationBuilder.CreateTable(
                name: "t_record_1",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DEPTBITM = table.Column<float>(type: "real", nullable: true),
                    DEPTBITV = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS = table.Column<float>(type: "real", nullable: true),
                    DEPTVERT = table.Column<float>(type: "real", nullable: true),
                    BLKPOS = table.Column<float>(type: "real", nullable: true),
                    ROPA = table.Column<float>(type: "real", nullable: true),
                    HKLA = table.Column<float>(type: "real", nullable: true),
                    HKLX = table.Column<float>(type: "real", nullable: true),
                    WOBA = table.Column<float>(type: "real", nullable: true),
                    WOBX = table.Column<float>(type: "real", nullable: true),
                    TORQA = table.Column<float>(type: "real", nullable: true),
                    TORQX = table.Column<float>(type: "real", nullable: true),
                    RPMA = table.Column<short>(type: "smallint", nullable: true),
                    SPPA = table.Column<float>(type: "real", nullable: true),
                    CHKP = table.Column<float>(type: "real", nullable: true),
                    SPM1 = table.Column<short>(type: "smallint", nullable: true),
                    SPM2 = table.Column<short>(type: "smallint", nullable: true),
                    SPM3 = table.Column<short>(type: "smallint", nullable: true),
                    TVOLACT = table.Column<float>(type: "real", nullable: true),
                    TVOLCACT = table.Column<float>(type: "real", nullable: true),
                    MFOP = table.Column<short>(type: "smallint", nullable: true),
                    MFOA = table.Column<float>(type: "real", nullable: true),
                    MFIA = table.Column<float>(type: "real", nullable: true),
                    MDOA = table.Column<float>(type: "real", nullable: true),
                    MDIA = table.Column<float>(type: "real", nullable: true),
                    MTOA = table.Column<float>(type: "real", nullable: true),
                    MTIA = table.Column<float>(type: "real", nullable: true),
                    MCOA = table.Column<float>(type: "real", nullable: true),
                    MCIA = table.Column<float>(type: "real", nullable: true),
                    STKC = table.Column<int>(type: "integer", nullable: true),
                    LAGSTKS = table.Column<short>(type: "smallint", nullable: true),
                    DEPTRETM = table.Column<float>(type: "real", nullable: true),
                    GASA = table.Column<float>(type: "real", nullable: true),
                    SPARE1 = table.Column<float>(type: "real", nullable: true),
                    SPARE2 = table.Column<float>(type: "real", nullable: true),
                    SPARE3 = table.Column<float>(type: "real", nullable: true),
                    SPARE4 = table.Column<float>(type: "real", nullable: true),
                    SPARE5 = table.Column<float>(type: "real", nullable: true),
                    TelemetryId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_record_1", x => new { x.id_telemetry, x.date });
                    table.ForeignKey(
                        name: "FK_t_record_1_RecordBase_id_telemetry_date",
                        columns: x => new { x.id_telemetry, x.date },
                        principalTable: "RecordBase",
                        principalColumns: new[] { "id_telemetry", "date" },
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_record_1_t_telemetry_TelemetryId",
                        column: x => x.TelemetryId,
                        principalTable: "t_telemetry",
                        principalColumn: "id");
                });

            migrationBuilder.CreateTable(
                name: "t_record_50",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DEPTBITM = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_MCRSTAT = table.Column<float>(type: "real", nullable: true),
                    MCRSTAT = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_SLVL_mc = table.Column<float>(type: "real", nullable: true),
                    SLVL_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_GDP_mc = table.Column<float>(type: "real", nullable: true),
                    GDP_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_RA33F2_mc = table.Column<float>(type: "real", nullable: true),
                    RA33F2_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_RP33F2_mc = table.Column<float>(type: "real", nullable: true),
                    RP33F2_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_RA33F4_mc = table.Column<float>(type: "real", nullable: true),
                    RA33F4_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_RP33F4_mc = table.Column<float>(type: "real", nullable: true),
                    RP33F4_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_RA33_mc = table.Column<float>(type: "real", nullable: true),
                    RA33_mc = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS_RP33_mc = table.Column<float>(type: "real", nullable: true),
                    RP33_mc = table.Column<float>(type: "real", nullable: true),
                    TelemetryId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_record_50", x => new { x.id_telemetry, x.date });
                    table.ForeignKey(
                        name: "FK_t_record_50_RecordBase_id_telemetry_date",
                        columns: x => new { x.id_telemetry, x.date },
                        principalTable: "RecordBase",
                        principalColumns: new[] { "id_telemetry", "date" },
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_record_50_t_telemetry_TelemetryId",
                        column: x => x.TelemetryId,
                        principalTable: "t_telemetry",
                        principalColumn: "id");
                });

            migrationBuilder.CreateTable(
                name: "t_record_60",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DEPTBITM = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS = table.Column<float>(type: "real", nullable: true),
                    Gtot = table.Column<float>(type: "real", nullable: true),
                    Gx = table.Column<float>(type: "real", nullable: true),
                    Gy = table.Column<float>(type: "real", nullable: true),
                    Gz = table.Column<float>(type: "real", nullable: true),
                    Btot = table.Column<float>(type: "real", nullable: true),
                    Bx = table.Column<float>(type: "real", nullable: true),
                    By = table.Column<float>(type: "real", nullable: true),
                    Bz = table.Column<float>(type: "real", nullable: true),
                    TelemetryId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_record_60", x => new { x.id_telemetry, x.date });
                    table.ForeignKey(
                        name: "FK_t_record_60_RecordBase_id_telemetry_date",
                        columns: x => new { x.id_telemetry, x.date },
                        principalTable: "RecordBase",
                        principalColumns: new[] { "id_telemetry", "date" },
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_record_60_t_telemetry_TelemetryId",
                        column: x => x.TelemetryId,
                        principalTable: "t_telemetry",
                        principalColumn: "id");
                });

            migrationBuilder.CreateTable(
                name: "t_record_61",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DEPTBITM = table.Column<float>(type: "real", nullable: true),
                    DEPTMEAS = table.Column<float>(type: "real", nullable: true),
                    PHL1F1 = table.Column<float>(type: "real", nullable: true),
                    PHL1F2 = table.Column<float>(type: "real", nullable: true),
                    PHL2F1 = table.Column<float>(type: "real", nullable: true),
                    PHL2F2 = table.Column<float>(type: "real", nullable: true),
                    ATT06H = table.Column<float>(type: "real", nullable: true),
                    ATT06L = table.Column<float>(type: "real", nullable: true),
                    ATT10H = table.Column<float>(type: "real", nullable: true),
                    ATT10L = table.Column<float>(type: "real", nullable: true),
                    Status = table.Column<float>(type: "real", nullable: true),
                    TelemetryId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_record_61", x => new { x.id_telemetry, x.date });
                    table.ForeignKey(
                        name: "FK_t_record_61_RecordBase_id_telemetry_date",
                        columns: x => new { x.id_telemetry, x.date },
                        principalTable: "RecordBase",
                        principalColumns: new[] { "id_telemetry", "date" },
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_record_61_t_telemetry_TelemetryId",
                        column: x => x.TelemetryId,
                        principalTable: "t_telemetry",
                        principalColumn: "id");
                });

            migrationBuilder.CreateTable(
                name: "t_record_7",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DEPTSVYM = table.Column<float>(type: "real", nullable: true),
                    DEPTSVYV = table.Column<float>(type: "real", nullable: true),
                    PASSNUM = table.Column<short>(type: "smallint", nullable: true),
                    DEPTMEAS = table.Column<float>(type: "real", nullable: true),
                    SVYTYPE = table.Column<string>(type: "text", nullable: true),
                    SVYINC = table.Column<float>(type: "real", nullable: true),
                    SVYAZU = table.Column<float>(type: "real", nullable: true),
                    SVYAZC = table.Column<float>(type: "real", nullable: true),
                    SVYMTF = table.Column<float>(type: "real", nullable: true),
                    SVYGTF = table.Column<float>(type: "real", nullable: true),
                    SVYNS = table.Column<float>(type: "real", nullable: true),
                    SVYEW = table.Column<float>(type: "real", nullable: true),
                    SVYDLS = table.Column<float>(type: "real", nullable: true),
                    SVYWALK = table.Column<float>(type: "real", nullable: true),
                    SPARE1 = table.Column<float>(type: "real", nullable: true),
                    SPARE2 = table.Column<float>(type: "real", nullable: true),
                    SPARE3 = table.Column<float>(type: "real", nullable: true),
                    SPARE4 = table.Column<float>(type: "real", nullable: true),
                    SPARE5 = table.Column<float>(type: "real", nullable: true),
                    TelemetryId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_record_7", x => new { x.id_telemetry, x.date });
                    table.ForeignKey(
                        name: "FK_t_record_7_RecordBase_id_telemetry_date",
                        columns: x => new { x.id_telemetry, x.date },
                        principalTable: "RecordBase",
                        principalColumns: new[] { "id_telemetry", "date" },
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_record_7_t_telemetry_TelemetryId",
                        column: x => x.TelemetryId,
                        principalTable: "t_telemetry",
                        principalColumn: "id");
                });

            migrationBuilder.CreateTable(
                name: "t_record_8",
                columns: table => new
                {
                    id_telemetry = table.Column<int>(type: "integer", nullable: false),
                    date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    DEPTMEAS = table.Column<float>(type: "real", nullable: true),
                    DEPTVERT = table.Column<float>(type: "real", nullable: true),
                    DEPTBITM = table.Column<float>(type: "real", nullable: true),
                    DEPTBITV = table.Column<float>(type: "real", nullable: true),
                    PASSNUM = table.Column<short>(type: "smallint", nullable: true),
                    DEPTRS1M = table.Column<float>(type: "real", nullable: true),
                    DEPTRS1V = table.Column<float>(type: "real", nullable: true),
                    MR1 = table.Column<float>(type: "real", nullable: true),
                    MR1C = table.Column<float>(type: "real", nullable: true),
                    DEPTRS2M = table.Column<float>(type: "real", nullable: true),
                    DEPTRS2V = table.Column<float>(type: "real", nullable: true),
                    MR2 = table.Column<float>(type: "real", nullable: true),
                    MR2C = table.Column<float>(type: "real", nullable: true),
                    DEPTGR1M = table.Column<float>(type: "real", nullable: true),
                    DEPTGR1V = table.Column<float>(type: "real", nullable: true),
                    MG1 = table.Column<float>(type: "real", nullable: true),
                    MG1C = table.Column<float>(type: "real", nullable: true),
                    DEPTGR2M = table.Column<float>(type: "real", nullable: true),
                    DEPTGR2V = table.Column<float>(type: "real", nullable: true),
                    MG2 = table.Column<float>(type: "real", nullable: true),
                    MG2C = table.Column<float>(type: "real", nullable: true),
                    DEPTP1M = table.Column<float>(type: "real", nullable: true),
                    DEPTP1V = table.Column<float>(type: "real", nullable: true),
                    MPO1 = table.Column<float>(type: "real", nullable: true),
                    DEPTP2M = table.Column<float>(type: "real", nullable: true),
                    DEPTP2V = table.Column<float>(type: "real", nullable: true),
                    MPO2 = table.Column<float>(type: "real", nullable: true),
                    MFTANN = table.Column<float>(type: "real", nullable: true),
                    MFTPIPE = table.Column<float>(type: "real", nullable: true),
                    MFRANN = table.Column<float>(type: "real", nullable: true),
                    MFRPIPE = table.Column<float>(type: "real", nullable: true),
                    DEPTFDM = table.Column<float>(type: "real", nullable: true),
                    DEPTFDV = table.Column<float>(type: "real", nullable: true),
                    MFD = table.Column<float>(type: "real", nullable: true),
                    DEPTCALM = table.Column<float>(type: "real", nullable: true),
                    DEPTCALV = table.Column<float>(type: "real", nullable: true),
                    MCLP = table.Column<float>(type: "real", nullable: true),
                    MFPP = table.Column<float>(type: "real", nullable: true),
                    MFFP = table.Column<float>(type: "real", nullable: true),
                    SPARE1 = table.Column<float>(type: "real", nullable: true),
                    SPARE2 = table.Column<float>(type: "real", nullable: true),
                    SPARE3 = table.Column<float>(type: "real", nullable: true),
                    SPARE4 = table.Column<float>(type: "real", nullable: true),
                    SPARE5 = table.Column<float>(type: "real", nullable: true),
                    SPARE6 = table.Column<float>(type: "real", nullable: true),
                    SPARE7 = table.Column<float>(type: "real", nullable: true),
                    SPARE8 = table.Column<float>(type: "real", nullable: true),
                    SPARE9 = table.Column<float>(type: "real", nullable: true),
                    TelemetryId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_record_8", x => new { x.id_telemetry, x.date });
                    table.ForeignKey(
                        name: "FK_t_record_8_RecordBase_id_telemetry_date",
                        columns: x => new { x.id_telemetry, x.date },
                        principalTable: "RecordBase",
                        principalColumns: new[] { "id_telemetry", "date" },
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_record_8_t_telemetry_TelemetryId",
                        column: x => x.TelemetryId,
                        principalTable: "t_telemetry",
                        principalColumn: "id");
                });

            migrationBuilder.CreateIndex(
                name: "IX_t_record_1_TelemetryId",
                table: "t_record_1",
                column: "TelemetryId");

            migrationBuilder.CreateIndex(
                name: "IX_t_record_50_TelemetryId",
                table: "t_record_50",
                column: "TelemetryId");

            migrationBuilder.CreateIndex(
                name: "IX_t_record_60_TelemetryId",
                table: "t_record_60",
                column: "TelemetryId");

            migrationBuilder.CreateIndex(
                name: "IX_t_record_61_TelemetryId",
                table: "t_record_61",
                column: "TelemetryId");

            migrationBuilder.CreateIndex(
                name: "IX_t_record_7_TelemetryId",
                table: "t_record_7",
                column: "TelemetryId");

            migrationBuilder.CreateIndex(
                name: "IX_t_record_8_TelemetryId",
                table: "t_record_8",
                column: "TelemetryId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "t_record_1");

            migrationBuilder.DropTable(
                name: "t_record_50");

            migrationBuilder.DropTable(
                name: "t_record_60");

            migrationBuilder.DropTable(
                name: "t_record_61");

            migrationBuilder.DropTable(
                name: "t_record_7");

            migrationBuilder.DropTable(
                name: "t_record_8");

            migrationBuilder.DropTable(
                name: "RecordBase");
        }
    }
}