fix Синхронизации

This commit is contained in:
Mikhail Kuznetsov
2023-08-23 15:47:20 +10:00
parent 260a20e9bf
commit 906982d08d
59 changed files with 8462 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;
using PARR.AIHIT.Models;
namespace PARR.AIHIT.Context
{
internal class AIHContext : DbContext
{
public DbSet<EK> EKs { get; set; }
public AIHContext() { }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;");
}
}
}

View File

@@ -0,0 +1,98 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.AIHIT.Models
{
public class EK
{
[Column("IP_АДРЕС")]
public string? IP { get; set; }
[Column("МЕТКА")]
public string? Metka { get; set; }
[Column("АКТИВЕН")]
public string? IsActive { get; set; }
[Column("ВАЖНЫЙ_ЭК")]
public string? IsImportant { get; set; }
[Column("ВРЕМЯ_СОЗДАНИЯ")]
public DateTime? CreateTime { get; set; }
[Column("ДОПОЛНИТЕЛЬНАЯ_ИНФОРМАЦИЯ")]
public string? AdditionalInfo { get; set; }
[Column("ЗОНА_ОТВЕТСТВЕННОСТИ")]
public string? ResponseArea { get; set; }
[Column("КАТЕГОРИЯ_ЭК")]
public string? EKCategory { get; set; }
[Column("КОД_ПОИСКАК")]
public string? EKFindCode { get; set; }
[Column("КОД_ПРОДУКТА")]
public string? ProductCode { get; set; }
[Column("КОД_УСЛУГИ")]
public string? ServiceCode { get; set; }
[Column("КРАТКОЕ_НАИМЕНОВАНИЕ")]
public string? ShortName { get; set; }
[Column("ОТВЕТСТВЕННЫЙ_ЗАК")]
public string? ResponsibleByEK { get; set; }
[Column("ПЛАНОВОЕ_ВРЕМЯ_ВОССТАНОВЛЕНИЯ")]
public DateTime? PlannedTimeToRepair { get; set; }
[Column("ПОДКАТЕГОРИЯ_ЭК")]
public string? EKSubCategory { get; set; }
[Column("ПОЛНОЕ_НАИМЕНОВАНИЕ")]
public string? FullName { get; set; }
[Column("ПРЕДПИСАНИЕ")]
public string? Prescription { get; set; }
[Column("ПРЕДПРИЯТИЕ")]
public string? Company { get; set; }
[Column("РАБОЧАЯ_ГР_ОТВ_ЗАК")]
public string? WorkGroup { get; set; }
[Column("РАСПОЛОЖЕНИЕ")]
public string? Location { get; set; }
[Column("РЕВИЗОРК")]
public string? EKRevizor { get; set; }
[Column("РЕГИСТРАТОРК")]
public string? EKRegister { get; set; }
[Column("СЕТЕВОЕМЯ")]
public string? NetworkName { get; set; }
[Column("СТАТУС")]
public string? Status { get; set; }
[Column("ТИП_ЭК")]
public string? EKType { get; set; }
[Column("ФАКТИЧЕСКОЕ_ЗАВЕРШЕНИЕКСПЛУАТАЦИИ")]
public DateTime? EndExplotationDate { get; set; }
[Column("ФАКТИЧЕСКОЕ_НАЧАЛОКСПЛУАТАЦИИ")]
public DateTime? StartExplotationDate { get; set; }
[Column("ЦЕЛЕВОЕ_ВРЕМЯ_ВОССТАНОВЛЕНИЯ")]
public string? TargetRepairTime { get; set; }
[Column("SYSMODTIME")]
public DateTime? SysModTime { get; set; }
[Column("SYSMODUSER")]
public string? SysModUser { get; set; }
[Column("НОВЫЙ_КОД_ПОИСКА")]
public string? NewEKFindCode { get; set; }
[Column("СТАРЫЙ_КОД_ПОИСКА")]
public string? OldEKFindCode { get; set; }
[Column("НАПРАВЛЕНИЕТСК")]
public string? CTSDirection { get; set; }
[Key]
[Column("ID")]
public int? ID { get; set; }
[Column("недостоверныеанные")]
public char? IsUnreliableData { get; set; }
[Column("РГ_смены")]
public string? ShiftWorkGroup { get; set; }
[Column("КлиентскоеО")]
public string? ClientSoftware { get; set; }
[Column("Клиентская_ОС")]
public string? ClientOS { get; set; }
[Column("Тип СУБД")]
public string? DBType { get; set; }
[Column("Тип сервера приложений")]
public string? APPType { get; set; }
[Column("Тип сервера ЦК БС")]
public string? CKBSServerType { get; set; }
[Column("Тип сервера ИБ")]
public string? IBServerType { get; set; }
[Column("Тип сервера инфраструктуры")]
public string? InfrastructureServerType { get; set; }
[Column("Тип сервера мониторинга")]
public string? MonitoringServerType { get; set; }
}
}

View File

@@ -3,6 +3,8 @@ using MailKit.Search;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using MimeKit;
using PARR.AIHIT.Context;
using PARR.AIHIT.Models;
using PARR.AIHIT.Settings;
using PARR.DAL.Contracts;
using PARR.DAL.Extensions;
@@ -210,7 +212,7 @@ namespace PARR.AIHIT
public async Task InvokeFromDatabase()
{
await GetAppTypesAsync();
/*
//Получаем зоны ответственности из БД
var respAreas = settingService.Get().Where(ra => ra.Group == AIHTITSettings.RespAreaGroupName).ToList();
@@ -302,7 +304,7 @@ namespace PARR.AIHIT
logger.LogInformation($"----- Создана запись rawDataEK {mappedEK.ShortName}({mappedEK.IP}) -----");
}
}
*/
//Разбираем сырые данные
//Получаем интересующие статусы ЭК

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PARR.DAL.Contracts
{
public class AIHTITSettings
{
public const string RespAreaGroupName = "ResponsibleArea";
public const string StatusGroupName = "Status";
public const string Delimiters = "Delimiters";
}
}

View File

@@ -0,0 +1,532 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230810000938_RnmPrevTblsV1")]
partial class RnmPrevTblsV1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Application");
});
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("V1_ApplicationInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationType");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Job");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategory");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournal");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobMode");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatus");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.V1_Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.V1_Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,697 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class RnmPrevTblsV1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
table: "ApplicationTypes");
migrationBuilder.DropTable(
name: "ApplicationsInHosts");
migrationBuilder.DropTable(
name: "JobJournals");
migrationBuilder.DropTable(
name: "Hosts");
migrationBuilder.DropTable(
name: "JobStatuses");
migrationBuilder.DropTable(
name: "Jobs");
migrationBuilder.DropTable(
name: "Applications");
migrationBuilder.DropTable(
name: "JobCategories");
migrationBuilder.DropTable(
name: "JobModes");
migrationBuilder.DropTable(
name: "JobTypes");
migrationBuilder.DropPrimaryKey(
name: "PK_ApplicationTypes",
table: "ApplicationTypes");
migrationBuilder.RenameTable(
name: "ApplicationTypes",
newName: "V1_ApplicationType");
migrationBuilder.RenameColumn(
name: "ApplicationTypeId",
table: "V1_ApplicationType",
newName: "V1_ApplicationTypeId");
migrationBuilder.RenameIndex(
name: "IX_ApplicationTypes_ApplicationTypeId",
table: "V1_ApplicationType",
newName: "IX_V1_ApplicationType_V1_ApplicationTypeId");
migrationBuilder.AddPrimaryKey(
name: "PK_V1_ApplicationType",
table: "V1_ApplicationType",
column: "Id");
migrationBuilder.CreateTable(
name: "V1_Application",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Application", x => x.Id);
table.ForeignKey(
name: "FK_V1_Application_V1_ApplicationType_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_Host",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
RegionalEK = table.Column<string>(type: "text", nullable: true),
LinkEK = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true),
Responsible = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Host", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobCategory",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobCategory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobMode",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobMode", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobStatus",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobStatus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobType",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobType", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationInHost",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationInHost", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationInHost_V1_Application_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Application",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_ApplicationInHost_V1_Host_HostId",
column: x => x.HostId,
principalTable: "V1_Host",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_Job",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ScriptName = table.Column<string>(type: "text", nullable: false),
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
Frequency = table.Column<int>(type: "integer", nullable: false),
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Job", x => x.Id);
table.ForeignKey(
name: "FK_V1_Job_V1_Application_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Application",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Job_V1_JobCategory_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "V1_JobCategory",
principalColumn: "Id");
table.ForeignKey(
name: "FK_V1_Job_V1_JobMode_JobModeId",
column: x => x.JobModeId,
principalTable: "V1_JobMode",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Job_V1_JobType_JobTypeId",
column: x => x.JobTypeId,
principalTable: "V1_JobType",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_JobJournal",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Other = table.Column<string>(type: "text", nullable: true),
TimeOut = table.Column<int>(type: "integer", nullable: true),
Info = table.Column<string>(type: "text", nullable: true),
JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobJournal", x => x.Id);
table.ForeignKey(
name: "FK_V1_JobJournal_V1_Host_HostId",
column: x => x.HostId,
principalTable: "V1_Host",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournal_V1_JobStatus_JobStatusId",
column: x => x.JobStatusId,
principalTable: "V1_JobStatus",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournal_V1_Job_JobId",
column: x => x.JobId,
principalTable: "V1_Job",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "V1_JobMode",
columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
values: new object[,]
{
{ new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
{ new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
});
migrationBuilder.InsertData(
table: "V1_JobStatus",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
values: new object[,]
{
{ new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
{ new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
});
migrationBuilder.CreateIndex(
name: "IX_V1_Application_ApplicationTypeId",
table: "V1_Application",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationInHost_ApplicationId",
table: "V1_ApplicationInHost",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationInHost_HostId",
table: "V1_ApplicationInHost",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_ApplicationId",
table: "V1_Job",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_JobCategoryId",
table: "V1_Job",
column: "JobCategoryId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_JobModeId",
table: "V1_Job",
column: "JobModeId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_JobTypeId",
table: "V1_Job",
column: "JobTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournal_HostId",
table: "V1_JobJournal",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournal_JobId",
table: "V1_JobJournal",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournal_JobStatusId",
table: "V1_JobJournal",
column: "JobStatusId");
migrationBuilder.AddForeignKey(
name: "FK_V1_ApplicationType_V1_ApplicationType_V1_ApplicationTypeId",
table: "V1_ApplicationType",
column: "V1_ApplicationTypeId",
principalTable: "V1_ApplicationType",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_V1_ApplicationType_V1_ApplicationType_V1_ApplicationTypeId",
table: "V1_ApplicationType");
migrationBuilder.DropTable(
name: "V1_ApplicationInHost");
migrationBuilder.DropTable(
name: "V1_JobJournal");
migrationBuilder.DropTable(
name: "V1_Host");
migrationBuilder.DropTable(
name: "V1_JobStatus");
migrationBuilder.DropTable(
name: "V1_Job");
migrationBuilder.DropTable(
name: "V1_Application");
migrationBuilder.DropTable(
name: "V1_JobCategory");
migrationBuilder.DropTable(
name: "V1_JobMode");
migrationBuilder.DropTable(
name: "V1_JobType");
migrationBuilder.DropPrimaryKey(
name: "PK_V1_ApplicationType",
table: "V1_ApplicationType");
migrationBuilder.RenameTable(
name: "V1_ApplicationType",
newName: "ApplicationTypes");
migrationBuilder.RenameColumn(
name: "V1_ApplicationTypeId",
table: "ApplicationTypes",
newName: "ApplicationTypeId");
migrationBuilder.RenameIndex(
name: "IX_V1_ApplicationType_V1_ApplicationTypeId",
table: "ApplicationTypes",
newName: "IX_ApplicationTypes_ApplicationTypeId");
migrationBuilder.AddPrimaryKey(
name: "PK_ApplicationTypes",
table: "ApplicationTypes",
column: "Id");
migrationBuilder.CreateTable(
name: "Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Applications", x => x.Id);
table.ForeignKey(
name: "FK_Applications_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Hosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
LinkEK = table.Column<string>(type: "text", nullable: true),
RegionalEK = table.Column<string>(type: "text", nullable: true),
Responsible = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Hosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobCategories",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobCategories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobModes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobModes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobStatuses",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobStatuses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ApplicationsInHosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationsInHosts", x => x.Id);
table.ForeignKey(
name: "FK_ApplicationsInHosts_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ApplicationsInHosts_Hosts_HostId",
column: x => x.HostId,
principalTable: "Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Jobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Frequency = table.Column<int>(type: "integer", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
ScriptName = table.Column<string>(type: "text", nullable: false),
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_Jobs_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Jobs_JobCategories_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "JobCategories",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Jobs_JobModes_JobModeId",
column: x => x.JobModeId,
principalTable: "JobModes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Jobs_JobTypes_JobTypeId",
column: x => x.JobTypeId,
principalTable: "JobTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "JobJournals",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false),
JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Info = table.Column<string>(type: "text", nullable: true),
Other = table.Column<string>(type: "text", nullable: true),
TimeOut = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_JobJournals", x => x.Id);
table.ForeignKey(
name: "FK_JobJournals_Hosts_HostId",
column: x => x.HostId,
principalTable: "Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_JobJournals_JobStatuses_JobStatusId",
column: x => x.JobStatusId,
principalTable: "JobStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_JobJournals_Jobs_JobId",
column: x => x.JobId,
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "JobModes",
columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
values: new object[,]
{
{ new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
{ new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
});
migrationBuilder.InsertData(
table: "JobStatuses",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
values: new object[,]
{
{ new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
{ new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
});
migrationBuilder.CreateIndex(
name: "IX_Applications_ApplicationTypeId",
table: "Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationsInHosts_ApplicationId",
table: "ApplicationsInHosts",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationsInHosts_HostId",
table: "ApplicationsInHosts",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_JobJournals_HostId",
table: "JobJournals",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_JobJournals_JobId",
table: "JobJournals",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_JobJournals_JobStatusId",
table: "JobJournals",
column: "JobStatusId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_ApplicationId",
table: "Jobs",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_JobCategoryId",
table: "Jobs",
column: "JobCategoryId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_JobModeId",
table: "Jobs",
column: "JobModeId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_JobTypeId",
table: "Jobs",
column: "JobTypeId");
migrationBuilder.AddForeignKey(
name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
table: "ApplicationTypes",
column: "ApplicationTypeId",
principalTable: "ApplicationTypes",
principalColumn: "Id");
}
}
}

View File

@@ -0,0 +1,740 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230810231939_TblsAIHIT")]
partial class TblsAIHIT
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<DateTime?>("CreateTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<DateTime?>("EndExplotationDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<DateTime?>("PlannedTimeToRepair")
.HasColumnType("timestamp with time zone");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<DateTime?>("StartExplotationDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<DateTime?>("SysModTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Строка подключения к базе данных АИХ ИТ",
Name = "ConnectionString",
Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ZAB",
Value = "94 - ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "DVS",
Value = "96-ДВС"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobModes");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatuses");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,805 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblsAIHIT : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "V1_ApplicationInHost");
migrationBuilder.DropTable(
name: "V1_JobJournal");
migrationBuilder.DropTable(
name: "V1_Host");
migrationBuilder.DropTable(
name: "V1_JobStatus");
migrationBuilder.DropTable(
name: "V1_Job");
migrationBuilder.DropTable(
name: "V1_Application");
migrationBuilder.DropTable(
name: "V1_JobCategory");
migrationBuilder.DropTable(
name: "V1_JobMode");
migrationBuilder.DropTable(
name: "V1_JobType");
migrationBuilder.DropTable(
name: "V1_ApplicationType");
migrationBuilder.EnsureSchema(
name: "AIHIT");
migrationBuilder.CreateTable(
name: "RawDataEKs",
schema: "AIHIT",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
IP = table.Column<string>(type: "text", nullable: true),
Metka = table.Column<string>(type: "text", nullable: true),
IsActive = table.Column<string>(type: "text", nullable: true),
IsImportant = table.Column<string>(type: "text", nullable: true),
CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
AdditionalInfo = table.Column<string>(type: "text", nullable: true),
ResponseArea = table.Column<string>(type: "text", nullable: true),
EKCategory = table.Column<string>(type: "text", nullable: true),
EKFindCode = table.Column<string>(type: "text", nullable: true),
ProductCode = table.Column<string>(type: "text", nullable: true),
ServiceCode = table.Column<string>(type: "text", nullable: true),
ShortName = table.Column<string>(type: "text", nullable: true),
ResponsibleByEK = table.Column<string>(type: "text", nullable: true),
PlannedTimeToRepair = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
EKSubCategory = table.Column<string>(type: "text", nullable: true),
FullName = table.Column<string>(type: "text", nullable: true),
Prescription = table.Column<string>(type: "text", nullable: true),
Company = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true),
Location = table.Column<string>(type: "text", nullable: true),
EKRevizor = table.Column<string>(type: "text", nullable: true),
EKRegister = table.Column<string>(type: "text", nullable: true),
NetworkName = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
EKType = table.Column<string>(type: "text", nullable: true),
EndExplotationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
StartExplotationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
TargetRepairTime = table.Column<string>(type: "text", nullable: true),
SysModTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
SysModUser = table.Column<string>(type: "text", nullable: true),
NewEKFindCode = table.Column<string>(type: "text", nullable: true),
OldEKFindCode = table.Column<string>(type: "text", nullable: true),
CTSDirection = table.Column<string>(type: "text", nullable: true),
AIHID = table.Column<int>(type: "integer", nullable: true),
IsUnreliableData = table.Column<char>(type: "character(1)", nullable: true),
ShiftWorkGroup = table.Column<string>(type: "text", nullable: true),
ClientSoftware = table.Column<string>(type: "text", nullable: true),
ClientOS = table.Column<string>(type: "text", nullable: true),
DBType = table.Column<string>(type: "text", nullable: true),
APPType = table.Column<string>(type: "text", nullable: true),
CKBSServerType = table.Column<string>(type: "text", nullable: true),
IBServerType = table.Column<string>(type: "text", nullable: true),
InfrastructureServerType = table.Column<string>(type: "text", nullable: true),
MonitoringServerType = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RawDataEKs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Settings",
schema: "AIHIT",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Group = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Value = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true),
V1_ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationTypes", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationTypes_V1_ApplicationTypes_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Hosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
RegionalEK = table.Column<string>(type: "text", nullable: true),
LinkEK = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true),
Responsible = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Hosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobCategorys",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobCategorys", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobModes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobModes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobStatuses",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobStatuses", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Applications", x => x.Id);
table.ForeignKey(
name: "FK_V1_Applications_V1_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationsInHost",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationsInHost", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Hosts_HostId",
column: x => x.HostId,
principalTable: "V1_Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_Jobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ScriptName = table.Column<string>(type: "text", nullable: false),
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
Frequency = table.Column<int>(type: "integer", nullable: false),
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_V1_Jobs_V1_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobCategorys_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "V1_JobCategorys",
principalColumn: "Id");
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobModes_JobModeId",
column: x => x.JobModeId,
principalTable: "V1_JobModes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Jobs_V1_JobTypes_JobTypeId",
column: x => x.JobTypeId,
principalTable: "V1_JobTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_JobJournals",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Other = table.Column<string>(type: "text", nullable: true),
TimeOut = table.Column<int>(type: "integer", nullable: true),
Info = table.Column<string>(type: "text", nullable: true),
JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobJournals", x => x.Id);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_Hosts_HostId",
column: x => x.HostId,
principalTable: "V1_Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_JobStatuses_JobStatusId",
column: x => x.JobStatusId,
principalTable: "V1_JobStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournals_V1_Jobs_JobId",
column: x => x.JobId,
principalTable: "V1_Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
schema: "AIHIT",
table: "Settings",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Group", "Name", "Value" },
values: new object[,]
{
{ new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Строка подключения к базе данных АИХ ИТ", null, "ConnectionString", "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;" },
{ new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "DVS", "96-ДВС" },
{ new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ZAB", "94 - ЗАБ" }
});
migrationBuilder.InsertData(
table: "V1_ApplicationTypes",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name", "V1_ApplicationTypeId" },
values: new object[,]
{
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP", null },
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS", null },
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB", null }
});
migrationBuilder.InsertData(
table: "V1_JobModes",
columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
values: new object[,]
{
{ new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
{ new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
});
migrationBuilder.InsertData(
table: "V1_JobStatuses",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
values: new object[,]
{
{ new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
{ new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
});
migrationBuilder.CreateIndex(
name: "IX_V1_Applications_ApplicationTypeId",
table: "V1_Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_ApplicationId",
table: "V1_ApplicationsInHost",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_HostId",
table: "V1_ApplicationsInHost",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationTypes_V1_ApplicationTypeId",
table: "V1_ApplicationTypes",
column: "V1_ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_HostId",
table: "V1_JobJournals",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_JobId",
table: "V1_JobJournals",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournals_JobStatusId",
table: "V1_JobJournals",
column: "JobStatusId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_ApplicationId",
table: "V1_Jobs",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobCategoryId",
table: "V1_Jobs",
column: "JobCategoryId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobModeId",
table: "V1_Jobs",
column: "JobModeId");
migrationBuilder.CreateIndex(
name: "IX_V1_Jobs_JobTypeId",
table: "V1_Jobs",
column: "JobTypeId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RawDataEKs",
schema: "AIHIT");
migrationBuilder.DropTable(
name: "Settings",
schema: "AIHIT");
migrationBuilder.DropTable(
name: "V1_ApplicationsInHost");
migrationBuilder.DropTable(
name: "V1_JobJournals");
migrationBuilder.DropTable(
name: "V1_Hosts");
migrationBuilder.DropTable(
name: "V1_JobStatuses");
migrationBuilder.DropTable(
name: "V1_Jobs");
migrationBuilder.DropTable(
name: "V1_Applications");
migrationBuilder.DropTable(
name: "V1_JobCategorys");
migrationBuilder.DropTable(
name: "V1_JobModes");
migrationBuilder.DropTable(
name: "V1_JobTypes");
migrationBuilder.DropTable(
name: "V1_ApplicationTypes");
migrationBuilder.CreateTable(
name: "V1_ApplicationType",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
V1_ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationType", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationType_V1_ApplicationType_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationType",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Host",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
LinkEK = table.Column<string>(type: "text", nullable: true),
RegionalEK = table.Column<string>(type: "text", nullable: true),
Responsible = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Host", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobCategory",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobCategory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobMode",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobMode", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobStatus",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobStatus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_JobType",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobType", x => x.Id);
});
migrationBuilder.CreateTable(
name: "V1_Application",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Application", x => x.Id);
table.ForeignKey(
name: "FK_V1_Application_V1_ApplicationType_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationInHost",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationInHost", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationInHost_V1_Application_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Application",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_ApplicationInHost_V1_Host_HostId",
column: x => x.HostId,
principalTable: "V1_Host",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_Job",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: true),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Frequency = table.Column<int>(type: "integer", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
ScriptName = table.Column<string>(type: "text", nullable: false),
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Job", x => x.Id);
table.ForeignKey(
name: "FK_V1_Job_V1_Application_ApplicationId",
column: x => x.ApplicationId,
principalTable: "V1_Application",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Job_V1_JobCategory_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "V1_JobCategory",
principalColumn: "Id");
table.ForeignKey(
name: "FK_V1_Job_V1_JobMode_JobModeId",
column: x => x.JobModeId,
principalTable: "V1_JobMode",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_Job_V1_JobType_JobTypeId",
column: x => x.JobTypeId,
principalTable: "V1_JobType",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_JobJournal",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false),
JobId = table.Column<Guid>(type: "uuid", nullable: false),
JobStatusId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
DateOper = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Info = table.Column<string>(type: "text", nullable: true),
Other = table.Column<string>(type: "text", nullable: true),
TimeOut = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_JobJournal", x => x.Id);
table.ForeignKey(
name: "FK_V1_JobJournal_V1_Host_HostId",
column: x => x.HostId,
principalTable: "V1_Host",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournal_V1_JobStatus_JobStatusId",
column: x => x.JobStatusId,
principalTable: "V1_JobStatus",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_V1_JobJournal_V1_Job_JobId",
column: x => x.JobId,
principalTable: "V1_Job",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "V1_ApplicationType",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name", "V1_ApplicationTypeId" },
values: new object[,]
{
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP", null },
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS", null },
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB", null }
});
migrationBuilder.InsertData(
table: "V1_JobMode",
columns: new[] { "Id", "DateCreated", "DateModified", "Name" },
values: new object[,]
{
{ new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "manual" },
{ new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "auto" }
});
migrationBuilder.InsertData(
table: "V1_JobStatus",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
values: new object[,]
{
{ new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
{ new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
});
migrationBuilder.CreateIndex(
name: "IX_V1_Application_ApplicationTypeId",
table: "V1_Application",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationInHost_ApplicationId",
table: "V1_ApplicationInHost",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationInHost_HostId",
table: "V1_ApplicationInHost",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationType_V1_ApplicationTypeId",
table: "V1_ApplicationType",
column: "V1_ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_ApplicationId",
table: "V1_Job",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_JobCategoryId",
table: "V1_Job",
column: "JobCategoryId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_JobModeId",
table: "V1_Job",
column: "JobModeId");
migrationBuilder.CreateIndex(
name: "IX_V1_Job_JobTypeId",
table: "V1_Job",
column: "JobTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournal_HostId",
table: "V1_JobJournal",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournal_JobId",
table: "V1_JobJournal",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_V1_JobJournal_JobStatusId",
table: "V1_JobJournal",
column: "JobStatusId");
}
}
}

View File

@@ -0,0 +1,740 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230811071304_TblAIHEKFixDatatype")]
partial class TblAIHEKFixDatatype
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("CreateTime")
.HasColumnType("text");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<string>("EndExplotationDate")
.HasColumnType("text");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<string>("PlannedTimeToRepair")
.HasColumnType("text");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<string>("StartExplotationDate")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("SysModTime")
.HasColumnType("text");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Строка подключения к базе данных АИХ ИТ",
Name = "ConnectionString",
Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ZAB",
Value = "94-ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "DVS",
Value = "96-ДВС"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobModes");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatuses");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,135 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblAIHEKFixDatatype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SysModTime",
schema: "AIHIT",
table: "RawDataEKs",
type: "text",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "StartExplotationDate",
schema: "AIHIT",
table: "RawDataEKs",
type: "text",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "PlannedTimeToRepair",
schema: "AIHIT",
table: "RawDataEKs",
type: "text",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "EndExplotationDate",
schema: "AIHIT",
table: "RawDataEKs",
type: "text",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreateTime",
schema: "AIHIT",
table: "RawDataEKs",
type: "text",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.UpdateData(
schema: "AIHIT",
table: "Settings",
keyColumn: "Id",
keyValue: new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
column: "Value",
value: "94-ЗАБ");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "SysModTime",
schema: "AIHIT",
table: "RawDataEKs",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "StartExplotationDate",
schema: "AIHIT",
table: "RawDataEKs",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "PlannedTimeToRepair",
schema: "AIHIT",
table: "RawDataEKs",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "EndExplotationDate",
schema: "AIHIT",
table: "RawDataEKs",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "CreateTime",
schema: "AIHIT",
table: "RawDataEKs",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.UpdateData(
schema: "AIHIT",
table: "Settings",
keyColumn: "Id",
keyValue: new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
column: "Value",
value: "94 - ЗАБ");
}
}
}

View File

@@ -0,0 +1,749 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230814013448_TblAIHSettingsAddValue1")]
partial class TblAIHSettingsAddValue1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("CreateTime")
.HasColumnType("text");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<string>("EndExplotationDate")
.HasColumnType("text");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<string>("PlannedTimeToRepair")
.HasColumnType("text");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<string>("StartExplotationDate")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("SysModTime")
.HasColumnType("text");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Строка подключения к базе данных АИХ ИТ",
Name = "ConnectionString",
Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ZAB",
Value = "94-ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "DVS",
Value = "96-ДВС"
},
new
{
Id = new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Статус актуальных ЭК",
Group = "Status",
Name = "Exploitation",
Value = "3-В эксплуатации"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobModes");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatuses");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblAIHSettingsAddValue1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
schema: "AIHIT",
table: "Settings",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Group", "Name", "Value" },
values: new object[] { new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Статус актуальных ЭК", "Status", "Exploitation", "3-В эксплуатации" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
schema: "AIHIT",
table: "Settings",
keyColumn: "Id",
keyValue: new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"));
}
}
}

View File

@@ -0,0 +1,779 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230814023034_TblHosts")]
partial class TblHosts
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("CreateTime")
.HasColumnType("text");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<string>("EndExplotationDate")
.HasColumnType("text");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<string>("PlannedTimeToRepair")
.HasColumnType("text");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<string>("StartExplotationDate")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("SysModTime")
.HasColumnType("text");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Строка подключения к базе данных АИХ ИТ",
Name = "ConnectionString",
Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ZAB",
Value = "94-ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "DVS",
Value = "96-ДВС"
},
new
{
Id = new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Статус актуальных ЭК",
Group = "Status",
Name = "Exploitation",
Value = "3-В эксплуатации"
});
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobModes");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatuses");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,39 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblHosts : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Hosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Hosts", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Hosts");
}
}
}

View File

@@ -0,0 +1,779 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230814030221_TblApplications")]
partial class TblApplications
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("CreateTime")
.HasColumnType("text");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<string>("EndExplotationDate")
.HasColumnType("text");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<string>("PlannedTimeToRepair")
.HasColumnType("text");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<string>("StartExplotationDate")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("SysModTime")
.HasColumnType("text");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Строка подключения к базе данных АИХ ИТ",
Name = "ConnectionString",
Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ZAB",
Value = "94-ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "DVS",
Value = "96-ДВС"
},
new
{
Id = new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Статус актуальных ЭК",
Group = "Status",
Name = "Exploitation",
Value = "3-В эксплуатации"
});
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid?>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobModes");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatuses");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.Application", b =>
{
b.HasOne("PARR.DAL.Models.V1.ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1.ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.V1.Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.V1.Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.V1.Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,205 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblApplications : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_ApplicationId",
table: "V1_ApplicationsInHost");
migrationBuilder.DropForeignKey(
name: "FK_V1_Jobs_V1_Applications_ApplicationId",
table: "V1_Jobs");
migrationBuilder.DropTable(
name: "V1_Applications");
migrationBuilder.DropTable(
name: "V1_ApplicationTypes");
migrationBuilder.CreateTable(
name: "ApplicationTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationTypes", x => x.Id);
table.ForeignKey(
name: "FK_ApplicationTypes_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "ApplicationTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Applications", x => x.Id);
table.ForeignKey(
name: "FK_Applications_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "ApplicationTypes",
columns: new[] { "Id", "ApplicationTypeId", "DateCreated", "DateModified", "Description", "Name" },
values: new object[,]
{
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP" },
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS" },
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), null, new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB" }
});
migrationBuilder.CreateIndex(
name: "IX_Applications_ApplicationTypeId",
table: "Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationTypes_ApplicationTypeId",
table: "ApplicationTypes",
column: "ApplicationTypeId");
migrationBuilder.AddForeignKey(
name: "FK_V1_ApplicationsInHost_Applications_ApplicationId",
table: "V1_ApplicationsInHost",
column: "ApplicationId",
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_V1_Jobs_Applications_ApplicationId",
table: "V1_Jobs",
column: "ApplicationId",
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_V1_ApplicationsInHost_Applications_ApplicationId",
table: "V1_ApplicationsInHost");
migrationBuilder.DropForeignKey(
name: "FK_V1_Jobs_Applications_ApplicationId",
table: "V1_Jobs");
migrationBuilder.DropTable(
name: "Applications");
migrationBuilder.DropTable(
name: "ApplicationTypes");
migrationBuilder.CreateTable(
name: "V1_ApplicationTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
V1_ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationTypes", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationTypes_V1_ApplicationTypes_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Applications", x => x.Id);
table.ForeignKey(
name: "FK_V1_Applications_V1_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "V1_ApplicationTypes",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name", "V1_ApplicationTypeId" },
values: new object[,]
{
{ new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СП xml АИХ ИТ", "APP", null },
{ new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле ОС xml АИХ ИТ", "OS", null },
{ new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Поле СУБД xml АИХ ИТ", "DB", null }
});
migrationBuilder.CreateIndex(
name: "IX_V1_Applications_ApplicationTypeId",
table: "V1_Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationTypes_V1_ApplicationTypeId",
table: "V1_ApplicationTypes",
column: "V1_ApplicationTypeId");
migrationBuilder.AddForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_ApplicationId",
table: "V1_ApplicationsInHost",
column: "ApplicationId",
principalTable: "V1_Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_V1_Jobs_V1_Applications_ApplicationId",
table: "V1_Jobs",
column: "ApplicationId",
principalTable: "V1_Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -0,0 +1,922 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230814052014_TblApplicationsInHost")]
partial class TblApplicationsInHost
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("CreateTime")
.HasColumnType("text");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<string>("EndExplotationDate")
.HasColumnType("text");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<string>("PlannedTimeToRepair")
.HasColumnType("text");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<string>("StartExplotationDate")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("SysModTime")
.HasColumnType("text");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("1ad12210-be62-459a-aa6c-fda7648503f7"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Строка подключения к базе данных АИХ ИТ",
Name = "ConnectionString",
Value = "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ZAB",
Value = "94-ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "DVS",
Value = "96-ДВС"
},
new
{
Id = new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Статус актуальных ЭК",
Group = "Status",
Name = "Exploitation",
Value = "3-В эксплуатации"
});
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("Applications");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid?>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.ToTable("V1_Applications");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<Guid?>("V1_ApplicationId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.HasIndex("V1_ApplicationId");
b.ToTable("V1_ApplicationsInHost");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("V1_ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
b.Property<string>("Responsible")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid?>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("V1_Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobCategorys");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset>("DateOper")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("V1_JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobModes");
b.HasData(
new
{
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "auto"
},
new
{
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Name = "manual"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobStatuses");
b.HasData(
new
{
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание запущено",
Name = "started"
},
new
{
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Задание выполнено",
Name = "finished"
});
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("V1_JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Application", null)
.WithMany("V1_ApplicationsInHosts")
.HasForeignKey("V1_ApplicationId");
b.Navigation("Application");
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", null)
.WithMany("V1_ApplicationTypes")
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.V1.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobMode");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.V1.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.V1.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{
b.Navigation("V1_ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_ApplicationType", b =>
{
b.Navigation("V1_ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,147 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblApplicationsInHost : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "V1_ApplicationId",
table: "V1_ApplicationsInHost",
type: "uuid",
nullable: true);
migrationBuilder.CreateTable(
name: "ApplicationsInHost",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationsInHost", x => x.Id);
table.ForeignKey(
name: "FK_ApplicationsInHost_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ApplicationsInHost_Hosts_HostId",
column: x => x.HostId,
principalTable: "Hosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "V1_ApplicationTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true),
V1_ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_ApplicationTypes", x => x.Id);
table.ForeignKey(
name: "FK_V1_ApplicationTypes_V1_ApplicationTypes_V1_ApplicationTypeId",
column: x => x.V1_ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "V1_Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_V1_Applications", x => x.Id);
table.ForeignKey(
name: "FK_V1_Applications_V1_ApplicationTypes_ApplicationTypeId",
column: x => x.ApplicationTypeId,
principalTable: "V1_ApplicationTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationsInHost_V1_ApplicationId",
table: "V1_ApplicationsInHost",
column: "V1_ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationsInHost_ApplicationId",
table: "ApplicationsInHost",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationsInHost_HostId",
table: "ApplicationsInHost",
column: "HostId");
migrationBuilder.CreateIndex(
name: "IX_V1_Applications_ApplicationTypeId",
table: "V1_Applications",
column: "ApplicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_V1_ApplicationTypes_V1_ApplicationTypeId",
table: "V1_ApplicationTypes",
column: "V1_ApplicationTypeId");
migrationBuilder.AddForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_V1_ApplicationId",
table: "V1_ApplicationsInHost",
column: "V1_ApplicationId",
principalTable: "V1_Applications",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_V1_ApplicationsInHost_V1_Applications_V1_ApplicationId",
table: "V1_ApplicationsInHost");
migrationBuilder.DropTable(
name: "ApplicationsInHost");
migrationBuilder.DropTable(
name: "V1_Applications");
migrationBuilder.DropTable(
name: "V1_ApplicationTypes");
migrationBuilder.DropIndex(
name: "IX_V1_ApplicationsInHost_V1_ApplicationId",
table: "V1_ApplicationsInHost");
migrationBuilder.DropColumn(
name: "V1_ApplicationId",
table: "V1_ApplicationsInHost");
}
}
}

View File

@@ -0,0 +1,59 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.AIHIT
{
[Table("RawDataEKs", Schema = "AIHIT")]
public class RawDataEK:IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? IP { get; set; }
public string? Metka { get; set; }
public string? IsActive { get; set; }
public string? IsImportant { get; set; }
public string? CreateTime { get; set; }
public string? AdditionalInfo { get; set; }
public string? ResponseArea { get; set; }
public string? EKCategory { get; set; }
public string? EKFindCode { get; set; }
public string? ProductCode { get; set; }
public string? ServiceCode { get; set; }
public string? ShortName { get; set; }
public string? ResponsibleByEK { get; set; }
public string? PlannedTimeToRepair { get; set; }
public string? EKSubCategory { get; set; }
public string? FullName { get; set; }
public string? Prescription { get; set; }
public string? Company { get; set; }
public string? WorkGroup { get; set; }
public string? Location { get; set; }
public string? EKRevizor { get; set; }
public string? EKRegister { get; set; }
public string? NetworkName { get; set; }
public string? Status { get; set; }
public string? EKType { get; set; }
public string? EndExplotationDate { get; set; }
public string? StartExplotationDate { get; set; }
public string? TargetRepairTime { get; set; }
public string? SysModTime { get; set; }
public string? SysModUser { get; set; }
public string? NewEKFindCode { get; set; }
public string? OldEKFindCode { get; set; }
public string? CTSDirection { get; set; }
public int? AIHID { get; set; }
public char? IsUnreliableData { get; set; }
public string? ShiftWorkGroup { get; set; }
public string? ClientSoftware { get; set; }
public string? ClientOS { get; set; }
public string? DBType { get; set; }
public string? APPType { get; set; }
public string? CKBSServerType { get; set; }
public string? IBServerType { get; set; }
public string? InfrastructureServerType { get; set; }
public string? MonitoringServerType { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.AIHIT
{
[Table("Settings", Schema = "AIHIT")]
public class Setting : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? Group { get; set; }
public required string Name { get; set; }
public required string Value { get; set; }
public string? Description { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Applications")]
public class Application : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public Guid ApplicationTypeId { get; set; }
[ForeignKey(nameof(ApplicationTypeId))]
public ApplicationType? ApplicationType { get; set; }
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
//public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
}
}

View File

@@ -0,0 +1,23 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationsInHost")]
public class ApplicationInHost : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public Host? Host { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationTypes")]
public class ApplicationType : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<ApplicationType> ApplicationTypes { get; set; } = new HashSet<ApplicationType>();
}
}

27
PARR.DAL/Models/Hosts.cs Normal file
View File

@@ -0,0 +1,27 @@
using PARR.DAL.Models.Base;
using PARR.DAL.Models.V1;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Hosts")]
public class Host : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? HostName { get; set; }
public required string IP { get; set; }
//public string? RegionalEK { get; set; }
//public string? LinkEK { get; set; }
public string? Status { get; set; }
public string? WorkGroup { get; set; }
//public string? Responsible { get; set; }
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
}
}

View File

@@ -0,0 +1,24 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_Applications")]
public class V1_Application : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public Guid ApplicationTypeId { get; set; }
[ForeignKey(nameof(ApplicationTypeId))]
public V1_ApplicationType? ApplicationType { get; set; }
public ICollection<V1_ApplicationInHost> V1_ApplicationsInHosts { get; set; } = new HashSet<V1_ApplicationInHost>();
//public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
}
}

View File

@@ -0,0 +1,23 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_ApplicationsInHost")]
public class V1_ApplicationInHost : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public V1_Host? Host { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_ApplicationTypes")]
public class V1_ApplicationType : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<V1_ApplicationType> V1_ApplicationTypes { get; set; } = new HashSet<V1_ApplicationType>();
}
}

View File

@@ -0,0 +1,27 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_Hosts")]
public class V1_Host : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? HostName { get; set; }
public required string IP { get; set; }
public string? RegionalEK { get; set; }
public string? LinkEK { get; set; }
public string? Status { get; set; }
public string? WorkGroup { get; set; }
public string? Responsible { get; set; }
public ICollection<V1_JobJournal> JobJournals { get; set; } = new HashSet<V1_JobJournal>();
public ICollection<V1_ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<V1_ApplicationInHost>();
}
}

View File

@@ -0,0 +1,50 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_Jobs")]
public class V1_Job : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public required string ScriptName { get; set; }
public Guid JobModeId { get; set; }
[ForeignKey(nameof(JobModeId))]
public V1_JobMode? JobMode { get; set; }
public Guid? JobCategoryId { get; set; }
[ForeignKey(nameof(JobCategoryId))]
public V1_JobCategory? JobCategorye { get; set; }
public Guid? JobTypeId { get; set; }
[ForeignKey(nameof(JobTypeId))]
public V1_JobType? JobType { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
/// <summary>
/// Частота запуска Job в минутах
/// </summary>
public int Frequency { get; set; }
/// <summary>
/// В режиме manual значит время регистрации регламентной работы АСУ ЕСПП, в auto - время старта Job.
/// </summary>
public DateTimeOffset StartAt { get; set; }
/// <summary>
/// Активация Job
/// </summary>
public bool IsEnabled { get; set; }
public ICollection<V1_JobJournal> Journals { get; set; } = new HashSet<V1_JobJournal>();
}
}

View File

@@ -0,0 +1,24 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_JobCategorys")]
public class V1_JobCategory : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// app, db
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<V1_Job> Jobs { get; set; } = new HashSet<V1_Job>();
}
}

View File

@@ -0,0 +1,39 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_JobJournals")]
public class V1_JobJournal : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public DateTimeOffset DateOper { get; set; }
public string? Other { get; set; }
//Возможно нужно перенести в Job
public int? TimeOut { get; set; }
//Возможно нужно перенести в Job
public string? Info { get; set; }
public Guid JobStatusId { get; set; }
[ForeignKey(nameof(JobStatusId))]
public V1_JobStatus? Status { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public V1_Host? Host { get; set; }
public Guid JobId { get; set; }
[ForeignKey(nameof(JobId))]
public V1_Job? Job { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_JobModes")]
public class V1_JobMode : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// manual, auto
/// </summary>
public required string Name { get; set; }
public ICollection<V1_Job> Jobs { get; set; } = new HashSet<V1_Job>();
}
}

View File

@@ -0,0 +1,24 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_JobStatuses")]
public class V1_JobStatus : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// started, finished, timeout, error
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<V1_JobJournal> Journals { get; set; } = new HashSet<V1_JobJournal>();
}
}

View File

@@ -0,0 +1,23 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
[Table("V1_JobTypes")]
public class V1_JobType : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// log-rotate, vacuum-psqld
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<V1_Job> Jobs { get; set; } = new HashSet<V1_Job>();
}
}

View File

@@ -0,0 +1,19 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.V1
{
//[Table("Schedulers")]
//public class Scheduler : IBase
//{
// //[Key]
// //public Guid Id { get; set; }
// //public DateTimeOffset DateCreated { get; set; }
// //public DateTimeOffset? DateModified { get; set; }
// //public string? Name { get; set; }
// //public int Frequency { get; set; }
// //public required DateTimeOffset StartAt { get; set; }
// //public bool IsEnabled { get; set; }
//}
}

View File

@@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.AIHIT;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.AIHIT;
namespace PARR.DAL.Services.Implementations.AIHIT
{
internal class RawDataEKService : BaseService<RawDataEK>, IRawDataEKService
{
private readonly DataContext dataContext;
private readonly ILogger<RawDataEKService> logger;
public RawDataEKService(DataContext dataContext, ILogger<RawDataEKService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
public void DeleteAll()
{
var startCount = EntitySet.Count();
if (startCount > 0)
{
EntitiContext.RawDataEKs.RemoveRange(EntitySet);
logger.LogInformation($"Из таблицы RawDataEK удалено {startCount} записей");
EntitiContext.SaveChanges();
}
}
protected override DbSet<RawDataEK> EntitySet => dataContext.RawDataEKs;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.AIHIT;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.AIHIT;
namespace PARR.DAL.Services.Implementations.AIHIT
{
internal class SettingService : BaseService<Setting>, ISettingService
{
private readonly DataContext dataContext;
private readonly ILogger<SettingService> logger;
public SettingService(DataContext dataContext, ILogger<SettingService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<Setting> EntitySet => dataContext.Settings;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_ApplicationInHostService : BaseService<V1_ApplicationInHost>, V1_IApplicationInHostService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_ApplicationInHostService> logger;
public V1_ApplicationInHostService(DataContext dataContext, ILogger<V1_ApplicationInHostService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_ApplicationInHost> EntitySet => dataContext.V1_ApplicationsInHosts;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_ApplicationService : BaseService<V1_Application>, V1_IApplicationService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_ApplicationService> logger;
public V1_ApplicationService(DataContext dataContext, ILogger<V1_ApplicationService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_Application> EntitySet => dataContext.V1_Applications;
protected override DataContext EntitiContext => dataContext;
public async Task<V1_Application?> GetByNameAsync(string appName)
{
return await EntitySet.FirstOrDefaultAsync(t => t.Name.ToLower() == appName.Trim().ToLower());
}
}
}

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_ApplicationTypeService : BaseService<V1_ApplicationType>, V1_IApplicationTypeService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_ApplicationTypeService> logger;
public V1_ApplicationTypeService(DataContext dataContext, ILogger<V1_ApplicationTypeService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_ApplicationType> EntitySet => dataContext.V1_ApplicationTypes;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,143 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.DomainModels;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_HostService : BaseService<V1_Host>, V1_IHostService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_HostService> logger;
protected override DbSet<V1_Host> EntitySet => dataContext.V1_Hosts;
protected override DataContext EntitiContext => dataContext;
public V1_HostService(DataContext dataContext, ILogger<V1_HostService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string RegionalEK)
{
//try
//{
// var host = await EntitySet.FirstAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
// return host;
//}
//catch
//{
// logger.LogInformation($"Не найден узел с IP адресом {IP} и региональным ЭК {RegionalEK}");
// return null;
//}
return await EntitySet
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
.AsSplitQuery()
.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
}
public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK)
{
return await EntitySet
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
.AsSplitQuery()
.FirstOrDefaultAsync(h => h.IP == IP && h.LinkEK == linkEK && h.RegionalEK == regionalEK);
}
public async Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
{
return await EntitySet.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
}
public Task<V1_Host?> GetAsync(Guid id)
{
throw new NotImplementedException();
}
public IQueryable<V1_Host> Get()
{
throw new NotImplementedException();
}
public IQueryable<V1_Host> GetPage(IQueryable<V1_Host> query, PaginationFilter paginationFilter)
{
throw new NotImplementedException();
}
public Task<bool> CreateAsync(V1_Host obj)
{
throw new NotImplementedException();
}
public Task<bool> AddRangeAsync(List<V1_Host> objs)
{
throw new NotImplementedException();
}
public Task<bool> DeleteAsync(Guid id)
{
throw new NotImplementedException();
}
public bool Delete(V1_Host obj)
{
throw new NotImplementedException();
}
public Task<bool> CommitAsync()
{
throw new NotImplementedException();
}
//public async Task<Host?> GetHostByRegionalEKAsync(string RegionalEK)И
//{
// try
// {
// var host = await EntitySet.FirstAsync(h => h.RegionalEK == RegionalEK);
// return host;
// }
// catch
// {
// logger.LogInformation($"Не найден узел с региональным ЭК {RegionalEK}");
// return null;
// }
//}
//public async Task<bool> UpdateAsync(Host host)
//{
// var orig = await EntitySet.FirstAsync(h => h.IP == host.IP);
// if (orig == null)
// return false;
// orig.DateModified = DateTimeOffset.UtcNow;
// orig.HostName = host.HostName;
// orig.RegionalEK = host.RegionalEK;
// orig.LinkEK = host.LinkEK;
// orig.Status = host.Status;
// orig.WorkGroup = host.WorkGroup;
// orig.Responsible = host.Responsible;
// orig.OS = host.OS;
// orig.DB = host.DB;
// orig.APP = host.APP;
// if (!await CommitAsync())
// {
// logger.LogError($"Ошибка обновления узла {host.IP}");
// return false;
// }
// else
// {
// logger.LogInformation($"Обновлен узел {host.IP}");
// return true;
// }
//}
}
}

View File

@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobCategoryService : BaseService<V1_JobCategory>, V1_IJobCategoryService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobCategoryService> logger;
public V1_JobCategoryService(DataContext dataContext, ILogger<V1_JobCategoryService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobCategory> EntitySet => dataContext.JobCategories;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Extensions;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobJournalService : BaseService<V1_JobJournal>, V1_IJobJournalService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobJournalService> logger;
public V1_JobJournalService(DataContext dataContext, ILogger<V1_JobJournalService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobJournal> EntitySet => dataContext.JobJournals;
protected override DataContext EntitiContext => dataContext;
public async Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date)
{
//var n=DateTimeOffset.UtcNow;
//var opers = await EntitySet
// .Where(j => j.JobId == jobId && j.HostId == hostId && (j.DateOper!=DateTimeOffset.MinValue))/*date.StartOfDay()*/// && j.DateOper < date.EndOfDay()))
// .OrderBy(t => t.DateOper)
// .LastOrDefaultAsync();
var opers = await EntitySet
.Where(j => j.JobId == jobId && j.HostId == hostId && j.DateOper.DateTime.Date == date.DateTime.Date)
.OrderBy(t => t.DateOper)
.LastOrDefaultAsync();
return opers;
}
}
}

View File

@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobModeService : BaseService<V1_JobMode>, V1_IJobModeService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobModeService> logger;
public V1_JobModeService(DataContext dataContext, ILogger<V1_JobModeService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobMode> EntitySet => dataContext.JobModes;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobService : BaseService<V1_Job>, V1_IJobService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobService> logger;
public V1_JobService(DataContext dataContext, ILogger<V1_JobService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_Job> EntitySet => dataContext.Jobs;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.V1;
namespace PARR.DAL.Services.Implementations.V1
{
internal class V1_JobStatusService : BaseService<V1_JobStatus>, V1_IJobStatusService
{
private readonly DataContext dataContext;
private readonly ILogger<V1_JobStatusService> logger;
public V1_JobStatusService(DataContext dataContext, ILogger<V1_JobStatusService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_JobStatus> EntitySet => dataContext.JobStatuses;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations.V1
{
//internal class SchedulerService : BaseService<Scheduler>, ISchedulerService
//{
// private readonly DataContext dataContext;
// public SchedulerService(DataContext dataContext, ILogger<SchedulerService> logger) : base(logger)
// {
// this.dataContext = dataContext;
// }
// protected override DbSet<Scheduler> EntitySet => dataContext.Schedulers;
// protected override DataContext EntitiContext => dataContext;
//}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.AIHIT
{
public interface IRawDataEKService : IBaseService<Models.AIHIT.RawDataEK>
{
void DeleteAll();
}
}

View File

@@ -0,0 +1,8 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.AIHIT
{
public interface ISettingService : IBaseService<Models.AIHIT.Setting>
{
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IApplicationInHostService : IBaseService<V1_ApplicationInHost>
{
}
}

View File

@@ -0,0 +1,10 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IApplicationService : IBaseService<V1_Application>
{
Task<V1_Application?> GetByNameAsync(string appName);
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IApplicationTypeService : IBaseService<V1_ApplicationType>
{
}
}

View File

@@ -0,0 +1,14 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IHostService : IBaseService<V1_Host>
{
Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK);
Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK);
//Task<Host?> GetHostByRegionalEKAsync(string LinkEK);
//Task<bool> UpdateAsync(Host host);
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
internal interface V1_IJobCategoryService : IBaseService<V1_JobCategory>
{
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IJobJournalService
{
Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date);
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
internal interface V1_IJobModeService : IBaseService<V1_JobMode>
{
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
public interface V1_IJobService : IBaseService<V1_Job>
{
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
internal interface V1_IJobStatusService : IBaseService<V1_JobStatus>
{
}
}

View File

@@ -0,0 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.V1
{
//public interface V1_ISchedulerService : IBaseService<V1_Scheduler>
//{
//}
}