using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace AsbCloudDb.Migrations
{
    /// <inheritdoc />
    public partial class Add_Tables_ProcessMapOperationsAndFunctions : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "differential_pressure_limit_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "flow_rate_limit_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "pressure_limit_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "rop_limit_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "tool_buckling",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "weight_on_bit_limit_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.RenameColumn(
                name: "pressure_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "pressure_max");

            migrationBuilder.RenameColumn(
                name: "weight_on_bit_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "weight_on_bit_max");

            migrationBuilder.RenameColumn(
                name: "top_drive_torque_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "top_drive_torque_max");

            migrationBuilder.RenameColumn(
                name: "rop_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "rop_max");

            migrationBuilder.RenameColumn(
                name: "revolutions_per_minute_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "rpm_max");

            migrationBuilder.RenameColumn(
                name: "revolution_per_minute",
                table: "t_process_map_plan_rotor",
                newName: "rpm");

            migrationBuilder.RenameColumn(
                name: "flow_rate_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "flow_rate_max");

            migrationBuilder.RenameColumn(
                name: "differential_pressure_limit_max",
                table: "t_process_map_plan_rotor",
                newName: "differential_pressure_max");

            migrationBuilder.AlterColumn<double>(
                name: "weight_on_bit",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                comment: "Нагрузка уставка, т.",
                oldClrType: typeof(double),
                oldType: "double precision",
                oldComment: "Нагрузка, т. Уставка");

            migrationBuilder.AlterColumn<double>(
                name: "flow_rate",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                comment: "Расход уставка, л/с.",
                oldClrType: typeof(double),
                oldType: "double precision",
                oldComment: "Расход л/с. Уставка");

            migrationBuilder.AlterColumn<double>(
                name: "differential_pressure",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                comment: "Перепад давления уставка, атм.",
                oldClrType: typeof(double),
                oldType: "double precision",
                oldComment: "Перепад давления, атм. Уставка");

            migrationBuilder.AddColumn<double>(
                name: "buckling",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Складывание инструмента, м.");

            migrationBuilder.AddColumn<double>(
                name: "differential_pressure_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Перепад давления ограничение, атм.");

            migrationBuilder.AddColumn<double>(
                name: "flow_rate_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Расход ограничение, л/с.");

            migrationBuilder.AddColumn<double>(
                name: "pressure_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Максимально допустимое давление, атм.");

            migrationBuilder.AddColumn<double>(
                name: "rop_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Максимально допустимая скорость, м/ч.");

            migrationBuilder.AddColumn<double>(
                name: "weight_on_bit_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Нагрузка ограничение, т.");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_anti_crash_rotation",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    top_drive_rpm_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты ВСП, об/мин"),
                    top_drive_start_min_flow_rate = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный расход для запуска оборотов  ВСП, л/сек"),
                    top_drive_torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимый момент на ВСП при противоаварийном вращении, кН*м"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_anti_crash_rotation", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_anti_crash_rotation_t_process_map_plan_a~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_anti_crash_rotation",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_anti_crash_rotation_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_anti_crash_rotation_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_anti_crash_rotation_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_anti_crash_rotation_t_well_section_type_~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Противоаварийное вращение");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_auto_hold_tf",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    zenit_angle = table.Column<double>(type: "double precision", nullable: false, comment: "Зенитный угол, градусы"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_auto_hold_tf", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_auto_hold_tf_t_process_map_plan_auto_hol~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_auto_hold_tf",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_auto_hold_tf_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_auto_hold_tf_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_auto_hold_tf_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_auto_hold_tf_t_well_section_type_id_well~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Автоудержание TF");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_drilltest",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    weight_on_bit_min = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка минимальная, т"),
                    weight_on_bit_steps_count = table.Column<int>(type: "integer", nullable: false, comment: "Количество шагов по нагрузке"),
                    rpm_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты на ВСП, об/мин."),
                    rpm_steps_count = table.Column<int>(type: "integer", nullable: false, comment: "Количество шагов оборотов на ВСП, об/мин."),
                    length_step = table.Column<double>(type: "double precision", nullable: false, comment: "Величина проходки шага, м."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_drilltest", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_drilltest_t_process_map_plan_drilltest_i~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_drilltest",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_drilltest_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_drilltest_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_drilltest_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_drilltest_t_well_section_type_id_wellsec~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "DrillTest");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_functions_damper",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    stick_slip = table.Column<double>(type: "double precision", nullable: false, comment: "StickSlip"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_functions_damper", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_functions_damper_t_process_map_plan_func~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_functions_damper",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_functions_damper_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_functions_damper_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_functions_damper_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_functions_damper_t_well_section_type_id_~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Демпфер");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_load_capacity",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    time_load_capacity_min = table.Column<double>(type: "double precision", nullable: false, comment: "Время выработки минимальное, сек"),
                    differential_pressure_min = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления минимальный, атм"),
                    weight_on_bit_min = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка минимальная, т"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_load_capacity", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_load_capacity_t_process_map_plan_load_ca~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_load_capacity",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_load_capacity_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_load_capacity_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_load_capacity_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_load_capacity_t_well_section_type_id_wel~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "РТК выработка нагрузки");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_operation_oscillation_angels",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    top_drive_torque = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, кН*м., Уставка"),
                    top_drive_torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, кН*м., Ограничение"),
                    rpm = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, об/мин., Уставка"),
                    rpm_max = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, об/мин., Ограничение"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_operation_oscillation_angels", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_oscillation_angels_t_process_m~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_operation_oscillation_angels",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_oscillation_angels_t_user_id_a~",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_oscillation_angels_t_user_id_e~",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_oscillation_angels_t_well_id_w~",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_oscillation_angels_t_well_sect~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Определение углов осцилляции");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_operation_reaming_rotor",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм."),
                    differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления уставка, атм."),
                    tight = table.Column<double>(type: "double precision", nullable: false, comment: "Затяжка, т."),
                    slacking_off = table.Column<double>(type: "double precision", nullable: false, comment: "Посадка, т."),
                    torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимый момент, кН*м."),
                    reaming1_repetitions_count = table.Column<int>(type: "integer", nullable: false, comment: "Проработка 1. Количество повторений, шт."),
                    reaming1_rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1. Скорость вверх, м/ч."),
                    reaming1_rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Скорость, м/ч., Вниз"),
                    reaming1_rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Обороты, об/мин., Вверх"),
                    reaming1_rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Обороты, об/мин., Вниз"),
                    reaming1_flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Расход, л/с., Вверх"),
                    reaming1_flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Расход, л/с., Вниз"),
                    reaming1_interval = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Интервал проработки, м."),
                    reaming1_stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    reaming2_repetitions_count = table.Column<int>(type: "integer", nullable: false, comment: "Проработка 2, Количество повторений, шт."),
                    reaming2_rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Скорость, м/ч., Вверх"),
                    reaming2_rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Скорость, м/ч., Вниз"),
                    reaming2_rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Обороты, об/мин., Вверх"),
                    reaming2_rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Обороты, об/мин., Вниз"),
                    reaming2_flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Расход, л/с., Вверх"),
                    reaming2_flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Расход, л/с., Вниз"),
                    reaming2_interval = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Интервал проработки, м."),
                    reaming2_stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    reaming3_repetitions_count = table.Column<int>(type: "integer", nullable: false, comment: "Проработка 3, Количество повторений, шт."),
                    reaming3_rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Скорость, м/ч., Вверх"),
                    reaming3_rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Скорость, м/ч., Вниз"),
                    reaming3_rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Обороты, об/мин., Вверх"),
                    reaming3_rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Обороты, об/мин., Вниз"),
                    reaming3_flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Расход, л/с., Вверх"),
                    reaming3_flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Расход, л/с., Вниз"),
                    reaming3_interval = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Интервал проработки, м."),
                    reaming3_stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_operation_reaming_rotor", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_reaming_rotor_t_process_map_pl~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_operation_reaming_rotor",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_reaming_rotor_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_reaming_rotor_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_reaming_rotor_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_reaming_rotor_t_well_section_t~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "РТК проработка ротор");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_operation_switching_off_the_pump",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    duration = table.Column<double>(type: "double precision", nullable: false, comment: "Продолжительность, сек."),
                    residual_pressure_limit = table.Column<double>(type: "double precision", nullable: false, comment: "Лимит остаточного давления, атм."),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_operation_switching_off_the_pump", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_switching_off_the_pump_t_proce~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_operation_switching_off_the_pump",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_switching_off_the_pump_t_user_~",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_switching_off_the_pump_t_user~1",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_switching_off_the_pump_t_well_~",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_operation_switching_off_the_pump_t_well~1",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Выключение насоса");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_oscillation",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    optimal_oscillation_angle = table.Column<double>(type: "double precision", nullable: false, comment: "Оптимальный угол осцилляции, градусы"),
                    Rpm_right = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вправо, об/мин"),
                    Rpm_left = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость влево, об/мин"),
                    torque_max_right = table.Column<double>(type: "double precision", nullable: false, comment: "Ограничение момента вправо, кН*м"),
                    torque_max_left = table.Column<double>(type: "double precision", nullable: false, comment: "Ограничение момента влево, кН*м"),
                    mode = table.Column<int>(type: "integer", nullable: false, comment: "Режим Авто/Руч"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_oscillation", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_oscillation_t_process_map_plan_oscillati~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_oscillation",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_oscillation_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_oscillation_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_oscillation_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_oscillation_t_well_section_type_id_wells~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Осцилляция");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_positioning_off_the_bottom",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    stop_off_the_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм."),
                    differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления уставка, атм."),
                    tight = table.Column<double>(type: "double precision", nullable: false, comment: "Затяжка, т."),
                    slacking_off = table.Column<double>(type: "double precision", nullable: false, comment: "Посадка, т."),
                    torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимый момент, кН*м."),
                    rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вверх, м/ч."),
                    rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вниз, м/ч."),
                    rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты вверх, об/мин."),
                    rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты вниз, об/мин."),
                    flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Расход вверх, л/с."),
                    flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Расход вниз, л/с."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_positioning_off_the_bottom", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_positioning_off_the_bottom_t_process_map~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_positioning_off_the_bottom",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_positioning_off_the_bottom_t_user_id_aut~",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_positioning_off_the_bottom_t_user_id_edi~",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_positioning_off_the_bottom_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_positioning_off_the_bottom_t_well_sectio~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Позиционирование над забоем");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_reaming_slide",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм."),
                    differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления уставка, атм."),
                    tight = table.Column<double>(type: "double precision", nullable: false, comment: "Затяжка, т."),
                    slacking_off = table.Column<double>(type: "double precision", nullable: false, comment: "Посадка, т."),
                    torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимый момент, кН*м."),
                    reaming1_repetitions_count = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1. Количество повторений, шт."),
                    reaming1_rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1. Скорость вверх, м/ч."),
                    reaming1_rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1. Скорость вниз, м/ч."),
                    reaming1_rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Обороты, об/мин., Вверх"),
                    reaming1_rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Обороты, об/мин., Вниз"),
                    reaming1_flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Расход, л/с., Вверх"),
                    reaming1_flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Расход, л/с., Вниз"),
                    reaming1_interval = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 1, Интервал проработки, м."),
                    reaming1_stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    reaming2_repetitions_count = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Количество повторений, шт."),
                    reaming2_rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Скорость, м/ч., Вверх"),
                    reaming2_rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Скорость, м/ч., Вниз"),
                    reaming2_rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Обороты, об/мин., Вверх"),
                    reaming2_rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Обороты, об/мин., Вниз"),
                    reaming2_flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Расход, л/с., Вверх"),
                    reaming2_flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Расход, л/с., Вниз"),
                    reaming2_interval = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 2, Интервал проработки, м."),
                    reaming2_stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    reaming3_repetitions_count = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Количество повторений, шт."),
                    reaming3_rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Скорость, м/ч., Вверх"),
                    reaming3_rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Скорость, м/ч., Вниз"),
                    reaming3_rpm_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Обороты, об/мин., Вверх"),
                    reaming3_rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Обороты, об/мин., Вниз"),
                    reaming3_flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Расход, л/с., Вверх"),
                    reaming3_flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Расход, л/с., Вниз"),
                    reaming3_interval = table.Column<double>(type: "double precision", nullable: false, comment: "Проработка 3, Интервал проработки, м."),
                    reaming3_stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_reaming_slide", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_reaming_slide_t_process_map_plan_reaming~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_reaming_slide",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_reaming_slide_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_reaming_slide_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_reaming_slide_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_reaming_slide_t_well_section_type_id_wel~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "РТК проработка слайд");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_recording_static_measurement",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    measurement_recording_time = table.Column<double>(type: "double precision", nullable: false, comment: "Время записи замера, сек"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_recording_static_measurement", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_recording_static_measurement_t_process_m~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_recording_static_measurement",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_recording_static_measurement_t_user_id_a~",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_recording_static_measurement_t_user_id_e~",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_recording_static_measurement_t_well_id_w~",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_recording_static_measurement_t_well_sect~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Запись статического замера");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_rotor_lowering_bit",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм."),
                    differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления уставка, атм."),
                    slacking_off = table.Column<double>(type: "double precision", nullable: false, comment: "Посадка, т."),
                    torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимый момент, кН*м."),
                    rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вниз, м/ч."),
                    rpm_down = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты вниз, об/мин."),
                    flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Расход вниз, л/с."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_rotor_lowering_bit", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_lowering_bit_t_process_map_plan_ro~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_rotor_lowering_bit",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_lowering_bit_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_lowering_bit_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_lowering_bit_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_lowering_bit_t_well_section_type_i~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "РТК подход к забою в роторе");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_rotor_rpm_acceleration",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    zenit_angle = table.Column<double>(type: "double precision", nullable: false, comment: "Зенитный угол, градусы"),
                    buckling = table.Column<double>(type: "double precision", nullable: false, comment: "Складывание, м"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_rotor_rpm_acceleration", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_rpm_acceleration_t_process_map_pla~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_rotor_rpm_acceleration",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_rpm_acceleration_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_rpm_acceleration_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_rpm_acceleration_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_rotor_rpm_acceleration_t_well_section_ty~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Выход на обороты перед ротором");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_slide_lowering_bit",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм."),
                    differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления уставка, атм."),
                    rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вниз, м/ч."),
                    flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Расход вниз, л/с."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_slide_lowering_bit", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_slide_lowering_bit_t_process_map_plan_sl~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_slide_lowering_bit",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_slide_lowering_bit_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_slide_lowering_bit_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_slide_lowering_bit_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_slide_lowering_bit_t_well_section_type_i~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "РТК подход к забою в слайде");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_static_measurement_output",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    signal_waiting_time = table.Column<double>(type: "double precision", nullable: false, comment: "Время ожидания выхода сигнала с ТМС, сек."),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_static_measurement_output", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_static_measurement_output_t_process_map_~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_static_measurement_output",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_static_measurement_output_t_user_id_auth~",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_static_measurement_output_t_user_id_edit~",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_static_measurement_output_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_static_measurement_output_t_well_section~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Выход статического замера");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_switching_to_the_mode",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ramp_time = table.Column<double>(type: "double precision", nullable: false, comment: "Время выхода буровых насосов на плановый расход, сек."),
                    flow_rate = table.Column<double>(type: "double precision", nullable: false, comment: "Расход, л/с"),
                    pressure_limit = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_switching_to_the_mode", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_switching_to_the_mode_t_process_map_plan~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_switching_to_the_mode",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_switching_to_the_mode_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_switching_to_the_mode_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_switching_to_the_mode_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_switching_to_the_mode_t_well_section_typ~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Выход на плановый расход");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_tf_orientation",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    tf_setpoint = table.Column<double>(type: "double precision", nullable: false, comment: "Задание TF, град."),
                    spring = table.Column<double>(type: "double precision", nullable: false, comment: "Пружина, град."),
                    pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальное давление, атм."),
                    differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм."),
                    tight = table.Column<double>(type: "double precision", nullable: false, comment: "Затяжка, т."),
                    slacking_off = table.Column<double>(type: "double precision", nullable: false, comment: "Посадка, т."),
                    torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимый момент, кН*м."),
                    repetitions_count = table.Column<int>(type: "integer", nullable: false, comment: "Количество расхаживаний, шт."),
                    rop_up = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вверх, м/ч."),
                    rop_down = table.Column<double>(type: "double precision", nullable: false, comment: "Скорость вниз, м/ч."),
                    flow_rate_up = table.Column<double>(type: "double precision", nullable: false, comment: "Расход вверх, л/с."),
                    flow_rate_down = table.Column<double>(type: "double precision", nullable: false, comment: "Расход вниз, л/с."),
                    interval = table.Column<double>(type: "double precision", nullable: false, comment: "Интервал расхаживания, м."),
                    stop_point_off_bottom = table.Column<double>(type: "double precision", nullable: false, comment: "Остановка над забоем, м."),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_tf_orientation", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_tf_orientation_t_process_map_plan_tf_ori~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_tf_orientation",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_tf_orientation_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_tf_orientation_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_tf_orientation_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_tf_orientation_t_well_section_type_id_we~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Выставление");

            migrationBuilder.CreateTable(
                name: "t_process_map_plan_updating_noload_parameters",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    id_decline_socket_column = table.Column<bool>(type: "boolean", nullable: false, comment: "СПУСК ОК Да/Нет"),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_plan_updating_noload_parameters", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_updating_noload_parameters_t_process_map~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_plan_updating_noload_parameters",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_updating_noload_parameters_t_user_id_aut~",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_updating_noload_parameters_t_user_id_edi~",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_updating_noload_parameters_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_plan_updating_noload_parameters_t_well_sectio~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "Обновление холостого хода");

            migrationBuilder.CreateTable(
                name: "t_process_map_shock_test",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    stick_slip = table.Column<double>(type: "double precision", nullable: false, comment: "stickSlip"),
                    whirl = table.Column<double>(type: "double precision", nullable: false, comment: "Whirl"),
                    axial_vibrations = table.Column<double>(type: "double precision", nullable: false, comment: "Осевые вибрации"),
                    combined_vibrations = table.Column<double>(type: "double precision", nullable: false, comment: "Комбинированные вибрации"),
                    weight_on_bit_min = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка минимальная, т"),
                    rpm_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты на ВСП, об/мин."),
                    note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
                    id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
                    id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
                    creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
                    obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
                    id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
                    id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
                    id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
                    depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
                    depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_process_map_shock_test", x => x.id);
                    table.ForeignKey(
                        name: "FK_t_process_map_shock_test_t_process_map_shock_test_id_previo~",
                        column: x => x.id_previous,
                        principalTable: "t_process_map_shock_test",
                        principalColumn: "id");
                    table.ForeignKey(
                        name: "FK_t_process_map_shock_test_t_user_id_author",
                        column: x => x.id_author,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_shock_test_t_user_id_editor",
                        column: x => x.id_editor,
                        principalTable: "t_user",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_t_process_map_shock_test_t_well_id_well",
                        column: x => x.id_well,
                        principalTable: "t_well",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_t_process_map_shock_test_t_well_section_type_id_wellsection~",
                        column: x => x.id_wellsection_type,
                        principalTable: "t_well_section_type",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "ShockTest");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_anti_crash_rotation_id_author",
                table: "t_process_map_plan_anti_crash_rotation",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_anti_crash_rotation_id_editor",
                table: "t_process_map_plan_anti_crash_rotation",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_anti_crash_rotation_id_previous",
                table: "t_process_map_plan_anti_crash_rotation",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_anti_crash_rotation_id_well",
                table: "t_process_map_plan_anti_crash_rotation",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_anti_crash_rotation_id_wellsection_type",
                table: "t_process_map_plan_anti_crash_rotation",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_auto_hold_tf_id_author",
                table: "t_process_map_plan_auto_hold_tf",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_auto_hold_tf_id_editor",
                table: "t_process_map_plan_auto_hold_tf",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_auto_hold_tf_id_previous",
                table: "t_process_map_plan_auto_hold_tf",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_auto_hold_tf_id_well",
                table: "t_process_map_plan_auto_hold_tf",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_auto_hold_tf_id_wellsection_type",
                table: "t_process_map_plan_auto_hold_tf",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_drilltest_id_author",
                table: "t_process_map_plan_drilltest",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_drilltest_id_editor",
                table: "t_process_map_plan_drilltest",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_drilltest_id_previous",
                table: "t_process_map_plan_drilltest",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_drilltest_id_well",
                table: "t_process_map_plan_drilltest",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_drilltest_id_wellsection_type",
                table: "t_process_map_plan_drilltest",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_functions_damper_id_author",
                table: "t_process_map_plan_functions_damper",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_functions_damper_id_editor",
                table: "t_process_map_plan_functions_damper",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_functions_damper_id_previous",
                table: "t_process_map_plan_functions_damper",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_functions_damper_id_well",
                table: "t_process_map_plan_functions_damper",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_functions_damper_id_wellsection_type",
                table: "t_process_map_plan_functions_damper",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_load_capacity_id_author",
                table: "t_process_map_plan_load_capacity",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_load_capacity_id_editor",
                table: "t_process_map_plan_load_capacity",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_load_capacity_id_previous",
                table: "t_process_map_plan_load_capacity",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_load_capacity_id_well",
                table: "t_process_map_plan_load_capacity",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_load_capacity_id_wellsection_type",
                table: "t_process_map_plan_load_capacity",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_oscillation_angels_id_author",
                table: "t_process_map_plan_operation_oscillation_angels",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_oscillation_angels_id_editor",
                table: "t_process_map_plan_operation_oscillation_angels",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_oscillation_angels_id_previous",
                table: "t_process_map_plan_operation_oscillation_angels",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_oscillation_angels_id_well",
                table: "t_process_map_plan_operation_oscillation_angels",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_oscillation_angels_id_wellsect~",
                table: "t_process_map_plan_operation_oscillation_angels",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_reaming_rotor_id_author",
                table: "t_process_map_plan_operation_reaming_rotor",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_reaming_rotor_id_editor",
                table: "t_process_map_plan_operation_reaming_rotor",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_reaming_rotor_id_previous",
                table: "t_process_map_plan_operation_reaming_rotor",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_reaming_rotor_id_well",
                table: "t_process_map_plan_operation_reaming_rotor",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_reaming_rotor_id_wellsection_t~",
                table: "t_process_map_plan_operation_reaming_rotor",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_switching_off_the_pump_id_auth~",
                table: "t_process_map_plan_operation_switching_off_the_pump",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_switching_off_the_pump_id_edit~",
                table: "t_process_map_plan_operation_switching_off_the_pump",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_switching_off_the_pump_id_prev~",
                table: "t_process_map_plan_operation_switching_off_the_pump",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_switching_off_the_pump_id_well",
                table: "t_process_map_plan_operation_switching_off_the_pump",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_operation_switching_off_the_pump_id_well~",
                table: "t_process_map_plan_operation_switching_off_the_pump",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_oscillation_id_author",
                table: "t_process_map_plan_oscillation",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_oscillation_id_editor",
                table: "t_process_map_plan_oscillation",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_oscillation_id_previous",
                table: "t_process_map_plan_oscillation",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_oscillation_id_well",
                table: "t_process_map_plan_oscillation",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_oscillation_id_wellsection_type",
                table: "t_process_map_plan_oscillation",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_positioning_off_the_bottom_id_author",
                table: "t_process_map_plan_positioning_off_the_bottom",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_positioning_off_the_bottom_id_editor",
                table: "t_process_map_plan_positioning_off_the_bottom",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_positioning_off_the_bottom_id_previous",
                table: "t_process_map_plan_positioning_off_the_bottom",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_positioning_off_the_bottom_id_well",
                table: "t_process_map_plan_positioning_off_the_bottom",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_positioning_off_the_bottom_id_wellsectio~",
                table: "t_process_map_plan_positioning_off_the_bottom",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_reaming_slide_id_author",
                table: "t_process_map_plan_reaming_slide",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_reaming_slide_id_editor",
                table: "t_process_map_plan_reaming_slide",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_reaming_slide_id_previous",
                table: "t_process_map_plan_reaming_slide",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_reaming_slide_id_well",
                table: "t_process_map_plan_reaming_slide",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_reaming_slide_id_wellsection_type",
                table: "t_process_map_plan_reaming_slide",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_recording_static_measurement_id_author",
                table: "t_process_map_plan_recording_static_measurement",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_recording_static_measurement_id_editor",
                table: "t_process_map_plan_recording_static_measurement",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_recording_static_measurement_id_previous",
                table: "t_process_map_plan_recording_static_measurement",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_recording_static_measurement_id_well",
                table: "t_process_map_plan_recording_static_measurement",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_recording_static_measurement_id_wellsect~",
                table: "t_process_map_plan_recording_static_measurement",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_lowering_bit_id_author",
                table: "t_process_map_plan_rotor_lowering_bit",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_lowering_bit_id_editor",
                table: "t_process_map_plan_rotor_lowering_bit",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_lowering_bit_id_previous",
                table: "t_process_map_plan_rotor_lowering_bit",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_lowering_bit_id_well",
                table: "t_process_map_plan_rotor_lowering_bit",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_lowering_bit_id_wellsection_type",
                table: "t_process_map_plan_rotor_lowering_bit",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_rpm_acceleration_id_author",
                table: "t_process_map_plan_rotor_rpm_acceleration",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_rpm_acceleration_id_editor",
                table: "t_process_map_plan_rotor_rpm_acceleration",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_rpm_acceleration_id_previous",
                table: "t_process_map_plan_rotor_rpm_acceleration",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_rpm_acceleration_id_well",
                table: "t_process_map_plan_rotor_rpm_acceleration",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_rotor_rpm_acceleration_id_wellsection_ty~",
                table: "t_process_map_plan_rotor_rpm_acceleration",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_slide_lowering_bit_id_author",
                table: "t_process_map_plan_slide_lowering_bit",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_slide_lowering_bit_id_editor",
                table: "t_process_map_plan_slide_lowering_bit",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_slide_lowering_bit_id_previous",
                table: "t_process_map_plan_slide_lowering_bit",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_slide_lowering_bit_id_well",
                table: "t_process_map_plan_slide_lowering_bit",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_slide_lowering_bit_id_wellsection_type",
                table: "t_process_map_plan_slide_lowering_bit",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_static_measurement_output_id_author",
                table: "t_process_map_plan_static_measurement_output",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_static_measurement_output_id_editor",
                table: "t_process_map_plan_static_measurement_output",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_static_measurement_output_id_previous",
                table: "t_process_map_plan_static_measurement_output",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_static_measurement_output_id_well",
                table: "t_process_map_plan_static_measurement_output",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_static_measurement_output_id_wellsection~",
                table: "t_process_map_plan_static_measurement_output",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_switching_to_the_mode_id_author",
                table: "t_process_map_plan_switching_to_the_mode",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_switching_to_the_mode_id_editor",
                table: "t_process_map_plan_switching_to_the_mode",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_switching_to_the_mode_id_previous",
                table: "t_process_map_plan_switching_to_the_mode",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_switching_to_the_mode_id_well",
                table: "t_process_map_plan_switching_to_the_mode",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_switching_to_the_mode_id_wellsection_type",
                table: "t_process_map_plan_switching_to_the_mode",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_tf_orientation_id_author",
                table: "t_process_map_plan_tf_orientation",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_tf_orientation_id_editor",
                table: "t_process_map_plan_tf_orientation",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_tf_orientation_id_previous",
                table: "t_process_map_plan_tf_orientation",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_tf_orientation_id_well",
                table: "t_process_map_plan_tf_orientation",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_tf_orientation_id_wellsection_type",
                table: "t_process_map_plan_tf_orientation",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_updating_noload_parameters_id_author",
                table: "t_process_map_plan_updating_noload_parameters",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_updating_noload_parameters_id_editor",
                table: "t_process_map_plan_updating_noload_parameters",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_updating_noload_parameters_id_previous",
                table: "t_process_map_plan_updating_noload_parameters",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_updating_noload_parameters_id_well",
                table: "t_process_map_plan_updating_noload_parameters",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_plan_updating_noload_parameters_id_wellsectio~",
                table: "t_process_map_plan_updating_noload_parameters",
                column: "id_wellsection_type");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_shock_test_id_author",
                table: "t_process_map_shock_test",
                column: "id_author");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_shock_test_id_editor",
                table: "t_process_map_shock_test",
                column: "id_editor");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_shock_test_id_previous",
                table: "t_process_map_shock_test",
                column: "id_previous");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_shock_test_id_well",
                table: "t_process_map_shock_test",
                column: "id_well");

            migrationBuilder.CreateIndex(
                name: "IX_t_process_map_shock_test_id_wellsection_type",
                table: "t_process_map_shock_test",
                column: "id_wellsection_type");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "t_process_map_plan_anti_crash_rotation");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_auto_hold_tf");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_drilltest");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_functions_damper");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_load_capacity");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_operation_oscillation_angels");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_operation_reaming_rotor");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_operation_switching_off_the_pump");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_oscillation");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_positioning_off_the_bottom");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_reaming_slide");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_recording_static_measurement");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_rotor_lowering_bit");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_rotor_rpm_acceleration");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_slide_lowering_bit");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_static_measurement_output");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_switching_to_the_mode");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_tf_orientation");

            migrationBuilder.DropTable(
                name: "t_process_map_plan_updating_noload_parameters");

            migrationBuilder.DropTable(
                name: "t_process_map_shock_test");

            migrationBuilder.DropColumn(
                name: "buckling",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "differential_pressure_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "flow_rate_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "pressure_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "rop_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.DropColumn(
                name: "weight_on_bit_max",
                table: "t_process_map_plan_slide");

            migrationBuilder.RenameColumn(
                name: "pressure_max",
                table: "t_process_map_plan_rotor",
                newName: "pressure_limit_max");

            migrationBuilder.RenameColumn(
                name: "weight_on_bit_max",
                table: "t_process_map_plan_rotor",
                newName: "weight_on_bit_limit_max");

            migrationBuilder.RenameColumn(
                name: "top_drive_torque_max",
                table: "t_process_map_plan_rotor",
                newName: "top_drive_torque_limit_max");

            migrationBuilder.RenameColumn(
                name: "rpm_max",
                table: "t_process_map_plan_rotor",
                newName: "revolutions_per_minute_limit_max");

            migrationBuilder.RenameColumn(
                name: "rpm",
                table: "t_process_map_plan_rotor",
                newName: "revolution_per_minute");

            migrationBuilder.RenameColumn(
                name: "rop_max",
                table: "t_process_map_plan_rotor",
                newName: "rop_limit_max");

            migrationBuilder.RenameColumn(
                name: "flow_rate_max",
                table: "t_process_map_plan_rotor",
                newName: "flow_rate_limit_max");

            migrationBuilder.RenameColumn(
                name: "differential_pressure_max",
                table: "t_process_map_plan_rotor",
                newName: "differential_pressure_limit_max");

            migrationBuilder.AlterColumn<double>(
                name: "weight_on_bit",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                comment: "Нагрузка, т. Уставка",
                oldClrType: typeof(double),
                oldType: "double precision",
                oldComment: "Нагрузка уставка, т.");

            migrationBuilder.AlterColumn<double>(
                name: "flow_rate",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                comment: "Расход л/с. Уставка",
                oldClrType: typeof(double),
                oldType: "double precision",
                oldComment: "Расход уставка, л/с.");

            migrationBuilder.AlterColumn<double>(
                name: "differential_pressure",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                comment: "Перепад давления, атм. Уставка",
                oldClrType: typeof(double),
                oldType: "double precision",
                oldComment: "Перепад давления уставка, атм.");

            migrationBuilder.AddColumn<double>(
                name: "differential_pressure_limit_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Перепад давления, атм. Ограничение");

            migrationBuilder.AddColumn<double>(
                name: "flow_rate_limit_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Расход л/с. Ограничение");

            migrationBuilder.AddColumn<double>(
                name: "pressure_limit_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Максимально допустимое давление, атм");

            migrationBuilder.AddColumn<double>(
                name: "rop_limit_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Максимально допустимая скорость, м/ч");

            migrationBuilder.AddColumn<double>(
                name: "tool_buckling",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Складывание инструмента, м");

            migrationBuilder.AddColumn<double>(
                name: "weight_on_bit_limit_max",
                table: "t_process_map_plan_slide",
                type: "double precision",
                nullable: false,
                defaultValue: 0.0,
                comment: "Нагрузка, т. Ограничение");
        }
    }
}