using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DD.Persistence.Database.Postgres.Migrations
{
///
public partial class Init : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:PostgresExtension:adminpack", ",,");
migrationBuilder.CreateTable(
name: "ChangeLog",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false, comment: "Ключ записи"),
IdDiscriminator = table.Column(type: "uuid", nullable: false, comment: "Дискриминатор таблицы"),
IdAuthor = table.Column(type: "uuid", nullable: false, comment: "Автор изменения"),
IdEditor = table.Column(type: "uuid", 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: "Дата устаревания (например при удалении)"),
IdNext = table.Column(type: "uuid", nullable: true, comment: "Id заменяющей записи"),
DepthStart = table.Column(type: "double precision", nullable: false, comment: "Глубина забоя на дату начала интервала"),
DepthEnd = table.Column(type: "double precision", nullable: false, comment: "Глубина забоя на дату окончания интервала"),
IdSection = table.Column(type: "uuid", nullable: false, comment: "Ключ секции"),
Value = table.Column(type: "jsonb", nullable: false, comment: "Значение")
},
constraints: table =>
{
table.PrimaryKey("PK_ChangeLog", x => x.Id);
});
migrationBuilder.CreateTable(
name: "DataSaub",
columns: table => new
{
date = table.Column(type: "timestamp with time zone", nullable: false),
mode = table.Column(type: "integer", nullable: true),
user = table.Column(type: "text", nullable: true),
wellDepth = table.Column(type: "double precision", nullable: true),
bitDepth = table.Column(type: "double precision", nullable: true),
blockPosition = table.Column(type: "double precision", nullable: true),
blockSpeed = table.Column(type: "double precision", nullable: true),
pressure = table.Column(type: "double precision", nullable: true),
axialLoad = table.Column(type: "double precision", nullable: true),
hookWeight = table.Column(type: "double precision", nullable: true),
rotorTorque = table.Column(type: "double precision", nullable: true),
rotorSpeed = table.Column(type: "double precision", nullable: true),
flow = table.Column(type: "double precision", nullable: true),
mseState = table.Column(type: "smallint", nullable: false),
idFeedRegulator = table.Column(type: "integer", nullable: false),
mse = table.Column(type: "double precision", nullable: true),
pump0Flow = table.Column(type: "double precision", nullable: true),
pump1Flow = table.Column(type: "double precision", nullable: true),
pump2Flow = table.Column(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DataSaub", x => x.date);
});
migrationBuilder.CreateTable(
name: "DataSourceSystem",
columns: table => new
{
SystemId = table.Column(type: "uuid", nullable: false, comment: "Id системы - источника данных"),
Name = table.Column(type: "varchar(256)", nullable: false, comment: "Наименование системы - источника данных"),
Description = table.Column(type: "text", nullable: true, comment: "Описание системы - источника данных")
},
constraints: table =>
{
table.PrimaryKey("PK_DataSourceSystem", x => x.SystemId);
});
migrationBuilder.CreateTable(
name: "ParameterData",
columns: table => new
{
DiscriminatorId = table.Column(type: "uuid", nullable: false, comment: "Дискриминатор системы"),
ParameterId = table.Column(type: "integer", nullable: false, comment: "Id параметра"),
Timestamp = table.Column(type: "timestamp with time zone", nullable: false, comment: "Временная отметка"),
Value = table.Column(type: "varchar(256)", nullable: false, comment: "Значение параметра в виде строки")
},
constraints: table =>
{
table.PrimaryKey("PK_ParameterData", x => new { x.DiscriminatorId, x.ParameterId, x.Timestamp });
});
migrationBuilder.CreateTable(
name: "Setpoint",
columns: table => new
{
Key = table.Column(type: "uuid", nullable: false, comment: "Ключ"),
Created = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата создания уставки"),
Value = table.Column