2024-12-10 19:23:43 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
2024-11-15 16:29:15 +05:00
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
|
|
namespace Persistence.Database.Postgres.Migrations
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
2024-11-26 15:07:18 +05:00
|
|
|
|
public partial class Init : Migration
|
2024-11-15 16:29:15 +05:00
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.AlterDatabase()
|
|
|
|
|
.Annotation("Npgsql:PostgresExtension:adminpack", ",,");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "DataSaub",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
2024-11-18 14:22:09 +05:00
|
|
|
|
date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
2024-11-15 16:29:15 +05:00
|
|
|
|
mode = table.Column<int>(type: "integer", nullable: true),
|
|
|
|
|
user = table.Column<string>(type: "text", nullable: true),
|
|
|
|
|
wellDepth = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
bitDepth = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
blockPosition = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
blockSpeed = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
pressure = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
axialLoad = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
hookWeight = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
rotorTorque = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
rotorSpeed = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
flow = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
mseState = table.Column<short>(type: "smallint", nullable: false),
|
|
|
|
|
idFeedRegulator = table.Column<int>(type: "integer", nullable: false),
|
|
|
|
|
mse = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
pump0Flow = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
pump1Flow = table.Column<double>(type: "double precision", nullable: true),
|
|
|
|
|
pump2Flow = table.Column<double>(type: "double precision", nullable: true)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
2024-11-22 15:47:00 +05:00
|
|
|
|
table.PrimaryKey("PK_DataSaub", x => x.date);
|
2024-11-15 16:29:15 +05:00
|
|
|
|
});
|
2024-11-26 15:07:18 +05:00
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Setpoint",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
Key = table.Column<Guid>(type: "uuid", nullable: false, comment: "Ключ"),
|
|
|
|
|
Created = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата создания уставки"),
|
|
|
|
|
Value = table.Column<object>(type: "jsonb", nullable: false, comment: "Значение уставки"),
|
|
|
|
|
IdUser = table.Column<int>(type: "integer", nullable: false, comment: "Id автора последнего изменения")
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Setpoint", x => new { x.Key, x.Created });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "TimestampedSets",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
IdDiscriminator = table.Column<Guid>(type: "uuid", nullable: false, comment: "Дискриминатор ссылка на тип сохраняемых данных"),
|
|
|
|
|
Timestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Отметка времени, строго в UTC"),
|
|
|
|
|
Set = table.Column<string>(type: "jsonb", nullable: false, comment: "Набор сохраняемых данных")
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_TimestampedSets", x => new { x.IdDiscriminator, x.Timestamp });
|
|
|
|
|
},
|
|
|
|
|
comment: "Общая таблица данных временных рядов");
|
2024-11-15 16:29:15 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "DataSaub");
|
2024-11-26 15:07:18 +05:00
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Setpoint");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "TimestampedSets");
|
2024-11-15 16:29:15 +05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|