DD.WellWorkover.Cloud/AsbCloudDb/Migrations/20220607095851_AddOperationValue.cs

61 lines
3.0 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class AddOperationValue : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_operationvalue",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Ид скважины"),
id_operation_category = table.Column<int>(type: "integer", nullable: false, comment: "Ид категории операции"),
target_value = table.Column<double>(type: "double precision", nullable: false, comment: "Целевой показатель"),
standard_value = table.Column<double>(type: "double precision", 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_operationvalue", x => x.id);
table.ForeignKey(
name: "FK_t_operationvalue_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_operationvalue_t_well_operation_category_id_operation_cat~",
column: x => x.id_operation_category,
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Целевые/нормативные показатели операции");
migrationBuilder.CreateIndex(
name: "IX_t_operationvalue_id_operation_category",
table: "t_operationvalue",
column: "id_operation_category");
migrationBuilder.CreateIndex(
name: "IX_t_operationvalue_id_well",
table: "t_operationvalue",
column: "id_well");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_operationvalue");
}
}
}