Создана таблица StatusTemplates
This commit is contained in:
@@ -3,6 +3,7 @@ using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.AIHIT;
|
||||
using PARR.DAL.Models.V1;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PARR.DAL.Context
|
||||
{
|
||||
@@ -27,6 +28,7 @@ namespace PARR.DAL.Context
|
||||
public DbSet<Setting> Settings { get; set; }
|
||||
public DbSet<RawDataEK> RawDataEKs { get; set; }
|
||||
public DbSet<Template> Templates { get; set; }
|
||||
public DbSet<StatusTemplate> StatusTemplates { get; set; }
|
||||
//public DbSet<Scheduler> Schedulers { get; set; }
|
||||
|
||||
//todo init application type+check migrations
|
||||
@@ -72,6 +74,18 @@ namespace PARR.DAL.Context
|
||||
new() { Id = new Guid("77C73C0A-8E4D-4676-B6E2-6A112F20E346"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.StatusGroupName, Name = "Exploitation", Value = "3-В эксплуатации", Description = "Статус актуальных ЭК" }
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Entity<StatusTemplate>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
|
||||
new() { Code = (int)StatusTemplateEnum.Creating, Name = StatusTemplateEnum.Creating.ToString(), Description = "Создали шаблон в ПАРР" },
|
||||
new() { Code = (int)StatusTemplateEnum.Updating, Name = StatusTemplateEnum.Updating.ToString(), Description = "Выявлено несоответствие. Требуется привлечение робота" },
|
||||
new() { Code = (int)StatusTemplateEnum.Ok, Name = StatusTemplateEnum.Ok.ToString(), Description = "Нормальное состояние шаблона в ЕСПП и ПАРР. Шаблон в ПАРР соответствует шаблону в ЕСПП" }
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
9
PARR.DAL/Contracts/StatusTemplateEnum.cs
Normal file
9
PARR.DAL/Contracts/StatusTemplateEnum.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace PARR.DAL.Contracts
|
||||
{
|
||||
public enum StatusTemplateEnum
|
||||
{
|
||||
Creating = 10,
|
||||
Updating = 20,
|
||||
Ok = 30
|
||||
}
|
||||
}
|
||||
1071
PARR.DAL/Migrations/20230914064130_TblStatusTemplate.Designer.cs
generated
Normal file
1071
PARR.DAL/Migrations/20230914064130_TblStatusTemplate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
101
PARR.DAL/Migrations/20230914064130_TblStatusTemplate.cs
Normal file
101
PARR.DAL/Migrations/20230914064130_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: "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,6 +377,47 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("Hosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
|
||||
{
|
||||
b.Property<int>("Code")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Code"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Code");
|
||||
|
||||
b.ToTable("StatusTemplates");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Code = 10,
|
||||
Description = "Создали шаблон в ПАРР",
|
||||
Name = "Creating"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 20,
|
||||
Description = "Выявлено несоответствие. Требуется привлечение робота",
|
||||
Name = "Updating"
|
||||
},
|
||||
new
|
||||
{
|
||||
Code = 30,
|
||||
Description = "Нормальное состояние шаблона в ЕСПП и ПАРР. Шаблон в ПАРР соответствует шаблону в ЕСПП",
|
||||
Name = "Ok"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Template", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -413,6 +454,9 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
@@ -433,9 +477,8 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
b.Property<int>("StatusCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubProcess")
|
||||
.IsRequired()
|
||||
@@ -457,11 +500,10 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("isActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StatusCode");
|
||||
|
||||
b.ToTable("Templates");
|
||||
});
|
||||
|
||||
@@ -849,6 +891,17 @@ namespace PARR.DAL.Migrations
|
||||
.HasForeignKey("ApplicationTypeId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Template", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.StatusTemplate", "StatusTemplate")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("StatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("StatusTemplate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
|
||||
@@ -963,6 +1016,11 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
|
||||
{
|
||||
b.Navigation("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
|
||||
{
|
||||
b.Navigation("V1_ApplicationsInHosts");
|
||||
|
||||
20
PARR.DAL/Models/StatusTemplate.cs
Normal file
20
PARR.DAL/Models/StatusTemplate.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
{
|
||||
[Table("StatusTemplates")]
|
||||
public class StatusTemplate
|
||||
{
|
||||
[Key]
|
||||
public int Code { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace PARR.DAL.Models
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public bool isActive { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public required string WorkGroup { get; set; }
|
||||
public required string ShortDescription { get; set; }
|
||||
public required string Category { get; set; }
|
||||
@@ -28,6 +28,13 @@ namespace PARR.DAL.Models
|
||||
public required string TNK { get; set; }
|
||||
public required string Work { get; set; }
|
||||
public required string Worker { get; set; }
|
||||
public required string Status { get; set; }
|
||||
|
||||
public int StatusCode { get; set; }
|
||||
|
||||
[ForeignKey(nameof(StatusCode))]
|
||||
public StatusTemplate StatusTemplate { get; set; } = new StatusTemplate();
|
||||
|
||||
//public required string Status { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user