using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using System; #nullable disable namespace AsbCloudDb.Migrations { public partial class Add_DetectedOperations : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "t_detected_operation", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), id_telemetry = table.Column(type: "integer", nullable: false), id_category = table.Column(type: "integer", nullable: false, comment: "Id категории операции"), id_user = table.Column(type: "integer", nullable: false, comment: "Id пользователя по телеметрии на момент начала операции"), date_start = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата начала операции"), date_end = table.Column(type: "timestamp with time zone", 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_detected_operation", x => x.id); table.ForeignKey( name: "FK_t_detected_operation_t_telemetry_id_telemetry", column: x => x.id_telemetry, principalTable: "t_telemetry", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_t_detected_operation_t_well_operation_category_id_category", column: x => x.id_category, principalTable: "t_well_operation_category", principalColumn: "id", onDelete: ReferentialAction.Cascade); }, comment: "автоматически определенные операции по телеметрии"); migrationBuilder.CreateIndex( name: "IX_t_detected_operation_id_category", table: "t_detected_operation", column: "id_category"); migrationBuilder.CreateIndex( name: "IX_t_detected_operation_id_telemetry", table: "t_detected_operation", column: "id_telemetry"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "t_detected_operation"); } } }