using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace AsbCloudDb.Migrations { /// public partial class Add_ProcessMapPlanSubsystems : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "t_process_map_plan_subsystems", columns: table => new { id = table.Column(type: "integer", nullable: false, comment: "Идентификатор") .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), auto_rotor = table.Column(type: "double precision", nullable: false, comment: "Процент использования ротора"), auto_slide = table.Column(type: "double precision", nullable: false, comment: "Процент использования слайда"), auto_oscillation = table.Column(type: "double precision", nullable: false, comment: "Процент использования слайда с осцилляцией"), note = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true, comment: "Примечание"), id_author = table.Column(type: "integer", nullable: false, comment: "Автор"), id_editor = table.Column(type: "integer", nullable: true, comment: "Редактор"), creation = table.Column(type: "timestamp with time zone", nullable: false, comment: "дата создания"), obsolete = table.Column(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"), id_state = table.Column(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"), id_previous = table.Column(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"), id_well = table.Column(type: "integer", nullable: false, comment: "Id скважины"), id_wellsection_type = table.Column(type: "integer", nullable: false, comment: "Тип секции"), depth_start = table.Column(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"), depth_end = table.Column(type: "double precision", nullable: false, comment: "Глубина по стволу до, м") }, constraints: table => { table.PrimaryKey("PK_t_process_map_plan_subsystems", x => x.id); table.ForeignKey( name: "FK_t_process_map_plan_subsystems_t_user_id_author", column: x => x.id_author, principalTable: "t_user", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_t_process_map_plan_subsystems_t_user_id_editor", column: x => x.id_editor, principalTable: "t_user", principalColumn: "id"); table.ForeignKey( name: "FK_t_process_map_plan_subsystems_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_subsystems_t_well_section_type_id_wellse~", column: x => x.id_wellsection_type, principalTable: "t_well_section_type", principalColumn: "id", onDelete: ReferentialAction.Cascade); }, comment: "РТК план использование подсистем"); migrationBuilder.CreateIndex( name: "IX_t_process_map_plan_subsystems_id_author", table: "t_process_map_plan_subsystems", column: "id_author"); migrationBuilder.CreateIndex( name: "IX_t_process_map_plan_subsystems_id_editor", table: "t_process_map_plan_subsystems", column: "id_editor"); migrationBuilder.CreateIndex( name: "IX_t_process_map_plan_subsystems_id_well", table: "t_process_map_plan_subsystems", column: "id_well"); migrationBuilder.CreateIndex( name: "IX_t_process_map_plan_subsystems_id_wellsection_type", table: "t_process_map_plan_subsystems", column: "id_wellsection_type"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "t_process_map_plan_subsystems"); } } }