using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace AsbCloudDb.Migrations { public partial class Remove_old_ProcessMapPlans : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "t_process_map_well_drilling"); migrationBuilder.DropTable( name: "t_process_map_well_ream"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "t_process_map_well_drilling", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), id_user = table.Column(type: "integer", nullable: false, comment: "Id пользователя"), id_well = table.Column(type: "integer", nullable: false, comment: "Id скважины"), id_wellsection_type = table.Column(type: "integer", nullable: false, comment: "Тип секции"), axial_load_limit_max = table.Column(type: "double precision", nullable: false, comment: "Нагрузка, допустимый максимум"), axial_load_plan = table.Column(type: "double precision", nullable: false, comment: "Нагрузка, план"), comment = table.Column(type: "text", nullable: true, comment: "Комментарий"), depth_end = table.Column(type: "double precision", nullable: false, comment: "Глубина по стволу до, м"), depth_start = table.Column(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"), flow_limit_max = table.Column(type: "double precision", nullable: false, comment: "Расход, допустимый максимум"), flow_plan = table.Column(type: "double precision", nullable: false, comment: "Расход, план"), id_mode = table.Column(type: "integer", nullable: false, comment: "Id режима (1- ротор, 2 слайд)"), last_update = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата последнего изменения"), pressure_limit_max = table.Column(type: "double precision", nullable: false, comment: "Перепад давления, допустимый максимум"), pressure_plan = table.Column(type: "double precision", nullable: false, comment: "Перепад давления, план"), rop_plan = table.Column(type: "double precision", nullable: false, comment: "Плановая механическая скорость, м/ч"), top_drive_speed_limit_max = table.Column(type: "double precision", nullable: false, comment: "Обороты на ВСП, допустимый максимум"), top_drive_speed_plan = table.Column(type: "double precision", nullable: false, comment: "Обороты на ВСП, план"), top_drive_torque_limit_max = table.Column(type: "double precision", nullable: false, comment: "Момент на ВСП, допустимый максимум"), top_drive_torque_plan = table.Column(type: "double precision", nullable: false, comment: "Момент на ВСП, план"), usage_saub = table.Column(type: "double precision", nullable: false, comment: "Плановый процент использования АКБ"), usage_spin = table.Column(type: "double precision", nullable: false, comment: "Плановый процент использования spin master") }, constraints: table => { table.PrimaryKey("PK_t_process_map_well_drilling", x => x.id); table.ForeignKey( name: "FK_t_process_map_well_drilling_t_user_id_user", column: x => x.id_user, principalTable: "t_user", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_t_process_map_well_drilling_t_well_id_well", column: x => x.id_well, principalTable: "t_well", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_t_process_map_well_drilling_t_well_section_type_id_wellsect~", column: x => x.id_wellsection_type, principalTable: "t_well_section_type", principalColumn: "id", onDelete: ReferentialAction.Cascade); }, comment: "РТК бурение скважины"); migrationBuilder.CreateTable( name: "t_process_map_well_ream", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), id_user = table.Column(type: "integer", nullable: false, comment: "Id пользователя"), id_well = table.Column(type: "integer", nullable: false, comment: "Id скважины"), id_wellsection_type = table.Column(type: "integer", nullable: false, comment: "Тип секции"), comment = table.Column(type: "text", nullable: true, comment: "Комментарий"), depth_end = table.Column(type: "double precision", nullable: false, comment: "Глубина по стволу до, м"), depth_start = table.Column(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"), last_update = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата последнего изменения"), pressure = table.Column(type: "double precision", nullable: false, comment: "Давление, атм"), repeats = table.Column(type: "double precision", nullable: false, comment: "Количество повторений"), setpoint_drag = table.Column(type: "double precision", nullable: false, comment: "Уставка зятяжки, т"), setpoint_tight = table.Column(type: "double precision", nullable: false, comment: "Уставка посадки, т"), speed_downward = table.Column(type: "double precision", nullable: false, comment: "Скорость спуска, м/ч"), speed_upward = table.Column(type: "double precision", nullable: false, comment: "Скорость подъёма, м/ч"), spin_downward = table.Column(type: "double precision", nullable: false, comment: "Вращение при движении вниз, об/мин"), spin_upward = table.Column(type: "double precision", nullable: false, comment: "Вращение при движении вверх, об/мин"), torque = table.Column(type: "double precision", nullable: false, comment: "Момент, кН*м") }, constraints: table => { table.PrimaryKey("PK_t_process_map_well_ream", x => x.id); table.ForeignKey( name: "FK_t_process_map_well_ream_t_user_id_user", column: x => x.id_user, principalTable: "t_user", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_t_process_map_well_ream_t_well_id_well", column: x => x.id_well, principalTable: "t_well", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_t_process_map_well_ream_t_well_section_type_id_wellsection_~", column: x => x.id_wellsection_type, principalTable: "t_well_section_type", principalColumn: "id", onDelete: ReferentialAction.Cascade); }, comment: "РТК проработка скважины"); migrationBuilder.CreateIndex( name: "IX_t_process_map_well_drilling_id_user", table: "t_process_map_well_drilling", column: "id_user"); migrationBuilder.CreateIndex( name: "IX_t_process_map_well_drilling_id_well", table: "t_process_map_well_drilling", column: "id_well"); migrationBuilder.CreateIndex( name: "IX_t_process_map_well_drilling_id_wellsection_type", table: "t_process_map_well_drilling", column: "id_wellsection_type"); migrationBuilder.CreateIndex( name: "IX_t_process_map_well_ream_id_user", table: "t_process_map_well_ream", column: "id_user"); migrationBuilder.CreateIndex( name: "IX_t_process_map_well_ream_id_well", table: "t_process_map_well_ream", column: "id_well"); migrationBuilder.CreateIndex( name: "IX_t_process_map_well_ream_id_wellsection_type", table: "t_process_map_well_ream", column: "id_wellsection_type"); } } }