using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using System; using System.Collections.Generic; 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(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), id_well = table.Column(type: "integer", nullable: false, comment: "id скважины"), id_author = table.Column(type: "integer", nullable: false, comment: "Id пользователя, загрузившего файл"), id_state = table.Column(type: "integer", nullable: false, comment: "0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"), date = table.Column(type: "timestamp with time zone", nullable: false), obsolescence = table.Column(type: "integer", nullable: false, comment: "сек. до устаревания"), setpoint_set = table.Column>(type: "jsonb", nullable: true, comment: "Набор уставок"), comment = table.Column(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"); } } }