Починил обновление статусов в шаблонах
This commit is contained in:
101
PARR.DAL/Migrations/20230915001323_TblStatusTemplate.cs
Normal file
101
PARR.DAL/Migrations/20230915001323_TblStatusTemplate.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
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 TblStatusTemplate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Status",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "isActive",
|
||||
table: "Templates",
|
||||
newName: "IsActive");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "StatusCode",
|
||||
table: "Templates",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StatusTemplates",
|
||||
columns: table => new
|
||||
{
|
||||
Code = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StatusTemplates", x => x.Code);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "StatusTemplates",
|
||||
columns: new[] { "Code", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 10, "Создали шаблон в ПАРР", "Creating" },
|
||||
{ 20, "Выявлено несоответствие. Требуется привлечение робота", "Updating" },
|
||||
{ 30, "Нормальное состояние шаблона в ЕСПП и ПАРР. Шаблон в ПАРР соответствует шаблону в ЕСПП", "Ok" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Templates_StatusCode",
|
||||
table: "Templates",
|
||||
column: "StatusCode");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_StatusTemplates_StatusCode",
|
||||
table: "Templates",
|
||||
column: "StatusCode",
|
||||
principalTable: "StatusTemplates",
|
||||
principalColumn: "Code",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_StatusTemplates_StatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StatusTemplates");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Templates_StatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StatusCode",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "IsActive",
|
||||
table: "Templates",
|
||||
newName: "isActive");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Status",
|
||||
table: "Templates",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user