using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Persistence.Database.Postgres.Migrations { /// public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("Npgsql:PostgresExtension:adminpack", ",,"); 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: "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(type: "jsonb", nullable: false, comment: "Значение уставки"), IdUser = table.Column(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(type: "uuid", nullable: false, comment: "Дискриминатор ссылка на тип сохраняемых данных"), Timestamp = table.Column(type: "timestamp with time zone", nullable: false, comment: "Отметка времени, строго в UTC"), Set = table.Column(type: "jsonb", nullable: false, comment: "Набор сохраняемых данных") }, constraints: table => { table.PrimaryKey("PK_TimestampedSets", x => new { x.IdDiscriminator, x.Timestamp }); }, comment: "Общая таблица данных временных рядов"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DataSaub"); migrationBuilder.DropTable( name: "Setpoint"); migrationBuilder.DropTable( name: "TimestampedSets"); } } }