Статусы ЭК вынесены из Hosts. Добавлен фильтр по статусам эк в генератор.
This commit is contained in:
84
PARR.DAL/Migrations/20230925040952_TblCreateEkStatus.cs
Normal file
84
PARR.DAL/Migrations/20230925040952_TblCreateEkStatus.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblCreateEkStatus : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "EkStatusCode",
|
||||
table: "Hosts",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 3);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EkStatuses",
|
||||
columns: table => new
|
||||
{
|
||||
Code = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EkStatuses", x => x.Code);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "EkStatuses",
|
||||
columns: new[] { "Code", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "1-Новый" },
|
||||
{ 2, "2-Подготовка к эксплуатации" },
|
||||
{ 3, "3-В эксплуатации" },
|
||||
{ 4, "4-В ремонте" },
|
||||
{ 5, "5-В резерве" },
|
||||
{ 6, "6-Выведен из эксплуатации" },
|
||||
{ 7, "7-Тестовый" },
|
||||
{ 9, "9-В разработке" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hosts_EkStatusCode",
|
||||
table: "Hosts",
|
||||
column: "EkStatusCode");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Hosts_EkStatuses_EkStatusCode",
|
||||
table: "Hosts",
|
||||
column: "EkStatusCode",
|
||||
principalTable: "EkStatuses",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Hosts_EkStatuses_EkStatusCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EkStatuses");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Hosts_EkStatusCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EkStatusCode",
|
||||
table: "Hosts");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user