forked from ddrilling/AsbCloudServer
62 lines
3.2 KiB
C#
62 lines
3.2 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using Microsoft.EntityFrameworkCore.Migrations;
|
||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||
|
||
namespace AsbCloudDb.Migrations
|
||
{
|
||
public partial class AddSetpoints : Migration
|
||
{
|
||
protected override void Up(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.CreateTable(
|
||
name: "t_setpoints_rquest",
|
||
columns: table => new
|
||
{
|
||
id = table.Column<int>(type: "integer", nullable: false)
|
||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
|
||
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Id пользователя, загрузившего файл"),
|
||
id_state = table.Column<int>(type: "integer", nullable: false, comment: "0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"),
|
||
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||
obsolescence = table.Column<int>(type: "integer", nullable: false, comment: "сек. до устаревания"),
|
||
setpoint_set = table.Column<Dictionary<string, double>>(type: "jsonb", nullable: true, comment: "Набор уставок"),
|
||
comment = table.Column<string>(type: "text", nullable: true, comment: "комментарий для оператора")
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_t_setpoints_rquest", x => x.id);
|
||
table.ForeignKey(
|
||
name: "FK_t_setpoints_rquest_t_user_id_author",
|
||
column: x => x.id_author,
|
||
principalTable: "t_user",
|
||
principalColumn: "id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
table.ForeignKey(
|
||
name: "FK_t_setpoints_rquest_t_well_id_well",
|
||
column: x => x.id_well,
|
||
principalTable: "t_well",
|
||
principalColumn: "id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
},
|
||
comment: "Запросы на изменение уставок панели оператора");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_t_setpoints_rquest_id_author",
|
||
table: "t_setpoints_rquest",
|
||
column: "id_author");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_t_setpoints_rquest_id_well",
|
||
table: "t_setpoints_rquest",
|
||
column: "id_well");
|
||
}
|
||
|
||
protected override void Down(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.DropTable(
|
||
name: "t_setpoints_rquest");
|
||
}
|
||
}
|
||
}
|