Добавлен справочник ResponseArea
This commit is contained in:
112
PARR.DAL/Migrations/20230928015451_AddResponseAreaEnum.cs
Normal file
112
PARR.DAL/Migrations/20230928015451_AddResponseAreaEnum.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
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 AddResponseAreaEnum : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Status",
|
||||
table: "Hosts",
|
||||
newName: "StatusStr");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ResponseArea",
|
||||
table: "Hosts",
|
||||
newName: "ResponseAreaStr");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ResponseAreaCode",
|
||||
table: "Hosts",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ResponseAreas",
|
||||
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_ResponseAreas", x => x.Code);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ResponseAreas",
|
||||
columns: new[] { "Code", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "01-ОКТ" },
|
||||
{ 10, "10-КЛГ" },
|
||||
{ 17, "17-МСК" },
|
||||
{ 24, "24-ГОР" },
|
||||
{ 28, "28-СЕВ" },
|
||||
{ 51, "51-СКВ" },
|
||||
{ 58, "58-ЮВСТ" },
|
||||
{ 61, "61-ПРИВ" },
|
||||
{ 63, "63-КБШ" },
|
||||
{ 76, "76-СВРД" },
|
||||
{ 80, "80-ЮУР" },
|
||||
{ 83, "83-ЗСИБ" },
|
||||
{ 88, "88-КРАСН" },
|
||||
{ 94, "92-ВСИБ" },
|
||||
{ 96, "96-ДВС" },
|
||||
{ 99, "00-ГВЦ" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hosts_ResponseAreaCode",
|
||||
table: "Hosts",
|
||||
column: "ResponseAreaCode");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Hosts_ResponseAreas_ResponseAreaCode",
|
||||
table: "Hosts",
|
||||
column: "ResponseAreaCode",
|
||||
principalTable: "ResponseAreas",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Hosts_ResponseAreas_ResponseAreaCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ResponseAreas");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Hosts_ResponseAreaCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ResponseAreaCode",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "StatusStr",
|
||||
table: "Hosts",
|
||||
newName: "Status");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ResponseAreaStr",
|
||||
table: "Hosts",
|
||||
newName: "ResponseArea");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user