From 906982d08d25320861672d951dcdf9cd5381d8bc Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Wed, 23 Aug 2023 15:47:20 +1000 Subject: [PATCH] =?UTF-8?q?fix=20=D0=A1=D0=B8=D0=BD=D1=85=D1=80=D0=BE?= =?UTF-8?q?=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.AIHIT/AIHIT/Context/AIHContext.cs | 16 + PARR.AIHIT/AIHIT/Models/EK.cs | 98 ++ PARR.AIHIT/AIHIT/Syncher.cs | 6 +- PARR.DAL/Contracts/AIHTITSettings.cs | 15 + .../20230810000938_RnmPrevTblsV1.Designer.cs | 532 ++++++++++ .../20230810000938_RnmPrevTblsV1.cs | 697 +++++++++++++ .../20230810231939_TblsAIHIT.Designer.cs | 740 ++++++++++++++ .../Migrations/20230810231939_TblsAIHIT.cs | 805 +++++++++++++++ ...0811071304_TblAIHEKFixDatatype.Designer.cs | 740 ++++++++++++++ .../20230811071304_TblAIHEKFixDatatype.cs | 135 +++ ...013448_TblAIHSettingsAddValue1.Designer.cs | 749 ++++++++++++++ .../20230814013448_TblAIHSettingsAddValue1.cs | 31 + .../20230814023034_TblHosts.Designer.cs | 779 +++++++++++++++ .../Migrations/20230814023034_TblHosts.cs | 39 + ...20230814030221_TblApplications.Designer.cs | 779 +++++++++++++++ .../20230814030221_TblApplications.cs | 205 ++++ ...14052014_TblApplicationsInHost.Designer.cs | 922 ++++++++++++++++++ .../20230814052014_TblApplicationsInHost.cs | 147 +++ PARR.DAL/Models/AIHIT/RawDataEK.cs | 59 ++ PARR.DAL/Models/AIHIT/Setting.cs | 21 + PARR.DAL/Models/Application.cs | 24 + PARR.DAL/Models/ApplicationInHost.cs | 23 + PARR.DAL/Models/ApplicationType.cs | 18 + PARR.DAL/Models/Hosts.cs | 27 + PARR.DAL/Models/V1/V1_Application.cs | 24 + PARR.DAL/Models/V1/V1_ApplicationInHost.cs | 23 + PARR.DAL/Models/V1/V1_ApplicationType.cs | 18 + PARR.DAL/Models/V1/V1_Host.cs | 27 + PARR.DAL/Models/V1/V1_Job.cs | 50 + PARR.DAL/Models/V1/V1_JobCategory.cs | 24 + PARR.DAL/Models/V1/V1_JobJournal.cs | 39 + PARR.DAL/Models/V1/V1_JobMode.cs | 23 + PARR.DAL/Models/V1/V1_JobStatus.cs | 24 + PARR.DAL/Models/V1/V1_JobType.cs | 23 + PARR.DAL/Models/V1/V1_Scheduler.cs | 19 + .../Implementations/AIHIT/RawDataEKService.cs | 39 + .../Implementations/AIHIT/SettingService.cs | 23 + .../V1/V1_ApplicationInHostService.cs | 25 + .../V1/V1_ApplicationService.cs | 30 + .../V1/V1_ApplicationTypeService.cs | 25 + .../Implementations/V1/V1_HostService.cs | 143 +++ .../V1/V1_JobCategoryService.cs | 24 + .../V1/V1_JobJournalService.cs | 41 + .../Implementations/V1/V1_JobModeService.cs | 24 + .../Implementations/V1/V1_JobService.cs | 30 + .../Implementations/V1/V1_JobStatusService.cs | 24 + .../Implementations/V1/V1_SchedulerService.cs | 22 + .../Interfaces/AIHIT/IRawDataEKService.cs | 9 + .../Interfaces/AIHIT/ISettingService.cs | 8 + .../V1/V1_IApplicationInHostService.cs | 9 + .../Interfaces/V1/V1_IApplicationService.cs | 10 + .../V1/V1_IApplicationTypeService.cs | 9 + .../Services/Interfaces/V1/V1_IHostService.cs | 14 + .../Interfaces/V1/V1_IJobCategoryService.cs | 9 + .../Interfaces/V1/V1_IJobJournalService.cs | 9 + .../Interfaces/V1/V1_IJobModeService.cs | 9 + .../Services/Interfaces/V1/V1_IJobService.cs | 9 + .../Interfaces/V1/V1_IJobStatusService.cs | 9 + .../Interfaces/V1/V1_ISchedulerService.cs | 9 + 59 files changed, 8462 insertions(+), 2 deletions(-) create mode 100644 PARR.AIHIT/AIHIT/Context/AIHContext.cs create mode 100644 PARR.AIHIT/AIHIT/Models/EK.cs create mode 100644 PARR.DAL/Contracts/AIHTITSettings.cs create mode 100644 PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.Designer.cs create mode 100644 PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.cs create mode 100644 PARR.DAL/Migrations/20230810231939_TblsAIHIT.Designer.cs create mode 100644 PARR.DAL/Migrations/20230810231939_TblsAIHIT.cs create mode 100644 PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.Designer.cs create mode 100644 PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.cs create mode 100644 PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.Designer.cs create mode 100644 PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.cs create mode 100644 PARR.DAL/Migrations/20230814023034_TblHosts.Designer.cs create mode 100644 PARR.DAL/Migrations/20230814023034_TblHosts.cs create mode 100644 PARR.DAL/Migrations/20230814030221_TblApplications.Designer.cs create mode 100644 PARR.DAL/Migrations/20230814030221_TblApplications.cs create mode 100644 PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.Designer.cs create mode 100644 PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.cs create mode 100644 PARR.DAL/Models/AIHIT/RawDataEK.cs create mode 100644 PARR.DAL/Models/AIHIT/Setting.cs create mode 100644 PARR.DAL/Models/Application.cs create mode 100644 PARR.DAL/Models/ApplicationInHost.cs create mode 100644 PARR.DAL/Models/ApplicationType.cs create mode 100644 PARR.DAL/Models/Hosts.cs create mode 100644 PARR.DAL/Models/V1/V1_Application.cs create mode 100644 PARR.DAL/Models/V1/V1_ApplicationInHost.cs create mode 100644 PARR.DAL/Models/V1/V1_ApplicationType.cs create mode 100644 PARR.DAL/Models/V1/V1_Host.cs create mode 100644 PARR.DAL/Models/V1/V1_Job.cs create mode 100644 PARR.DAL/Models/V1/V1_JobCategory.cs create mode 100644 PARR.DAL/Models/V1/V1_JobJournal.cs create mode 100644 PARR.DAL/Models/V1/V1_JobMode.cs create mode 100644 PARR.DAL/Models/V1/V1_JobStatus.cs create mode 100644 PARR.DAL/Models/V1/V1_JobType.cs create mode 100644 PARR.DAL/Models/V1/V1_Scheduler.cs create mode 100644 PARR.DAL/Services/Implementations/AIHIT/RawDataEKService.cs create mode 100644 PARR.DAL/Services/Implementations/AIHIT/SettingService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_ApplicationInHostService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_ApplicationService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_ApplicationTypeService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_HostService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_JobCategoryService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_JobJournalService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_JobModeService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_JobService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_JobStatusService.cs create mode 100644 PARR.DAL/Services/Implementations/V1/V1_SchedulerService.cs create mode 100644 PARR.DAL/Services/Interfaces/AIHIT/IRawDataEKService.cs create mode 100644 PARR.DAL/Services/Interfaces/AIHIT/ISettingService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IApplicationInHostService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IApplicationService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IApplicationTypeService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IHostService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IJobCategoryService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IJobJournalService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IJobModeService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IJobService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_IJobStatusService.cs create mode 100644 PARR.DAL/Services/Interfaces/V1/V1_ISchedulerService.cs diff --git a/PARR.AIHIT/AIHIT/Context/AIHContext.cs b/PARR.AIHIT/AIHIT/Context/AIHContext.cs new file mode 100644 index 00000000..2cbe7c0a --- /dev/null +++ b/PARR.AIHIT/AIHIT/Context/AIHContext.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using PARR.AIHIT.Models; + +namespace PARR.AIHIT.Context +{ + internal class AIHContext : DbContext + { + public DbSet 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;"); + } + } +} diff --git a/PARR.AIHIT/AIHIT/Models/EK.cs b/PARR.AIHIT/AIHIT/Models/EK.cs new file mode 100644 index 00000000..001ea3ec --- /dev/null +++ b/PARR.AIHIT/AIHIT/Models/EK.cs @@ -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; } + } +} diff --git a/PARR.AIHIT/AIHIT/Syncher.cs b/PARR.AIHIT/AIHIT/Syncher.cs index 15712106..f3428217 100644 --- a/PARR.AIHIT/AIHIT/Syncher.cs +++ b/PARR.AIHIT/AIHIT/Syncher.cs @@ -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}) -----"); } } - */ + //Разбираем сырые данные //Получаем интересующие статусы ЭК diff --git a/PARR.DAL/Contracts/AIHTITSettings.cs b/PARR.DAL/Contracts/AIHTITSettings.cs new file mode 100644 index 00000000..d6c727a3 --- /dev/null +++ b/PARR.DAL/Contracts/AIHTITSettings.cs @@ -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"; + } +} diff --git a/PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.Designer.cs b/PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.Designer.cs new file mode 100644 index 00000000..bbfcb1b9 --- /dev/null +++ b/PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.Designer.cs @@ -0,0 +1,532 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationTypeId"); + + b.ToTable("V1_Application"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategory"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.cs b/PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.cs new file mode 100644 index 00000000..17af106e --- /dev/null +++ b/PARR.DAL/Migrations/20230810000938_RnmPrevTblsV1.cs @@ -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 +{ + /// + public partial class RnmPrevTblsV1 : Migration + { + /// + 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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + HostName = table.Column(type: "text", nullable: true), + IP = table.Column(type: "text", nullable: false), + RegionalEK = table.Column(type: "text", nullable: true), + LinkEK = table.Column(type: "text", nullable: true), + Status = table.Column(type: "text", nullable: true), + WorkGroup = table.Column(type: "text", nullable: true), + Responsible = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + ApplicationId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + ScriptName = table.Column(type: "text", nullable: false), + JobModeId = table.Column(type: "uuid", nullable: false), + JobCategoryId = table.Column(type: "uuid", nullable: true), + JobTypeId = table.Column(type: "uuid", nullable: true), + ApplicationId = table.Column(type: "uuid", nullable: false), + Frequency = table.Column(type: "integer", nullable: false), + StartAt = table.Column(type: "timestamp with time zone", nullable: false), + IsEnabled = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + DateOper = table.Column(type: "timestamp with time zone", nullable: false), + Other = table.Column(type: "text", nullable: true), + TimeOut = table.Column(type: "integer", nullable: true), + Info = table.Column(type: "text", nullable: true), + JobStatusId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(type: "uuid", nullable: false), + JobId = table.Column(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"); + } + + /// + 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(type: "uuid", nullable: false), + ApplicationTypeId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + HostName = table.Column(type: "text", nullable: true), + IP = table.Column(type: "text", nullable: false), + LinkEK = table.Column(type: "text", nullable: true), + RegionalEK = table.Column(type: "text", nullable: true), + Responsible = table.Column(type: "text", nullable: true), + Status = table.Column(type: "text", nullable: true), + WorkGroup = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Hosts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "JobCategories", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobCategories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "JobModes", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobModes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "JobStatuses", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobStatuses", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "JobTypes", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ApplicationsInHosts", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ApplicationId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(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(type: "uuid", nullable: false), + ApplicationId = table.Column(type: "uuid", nullable: false), + JobCategoryId = table.Column(type: "uuid", nullable: true), + JobModeId = table.Column(type: "uuid", nullable: false), + JobTypeId = table.Column(type: "uuid", nullable: true), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Frequency = table.Column(type: "integer", nullable: false), + IsEnabled = table.Column(type: "boolean", nullable: false), + Name = table.Column(type: "text", nullable: false), + ScriptName = table.Column(type: "text", nullable: false), + StartAt = table.Column(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(type: "uuid", nullable: false), + HostId = table.Column(type: "uuid", nullable: false), + JobId = table.Column(type: "uuid", nullable: false), + JobStatusId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + DateOper = table.Column(type: "timestamp with time zone", nullable: false), + Info = table.Column(type: "text", nullable: true), + Other = table.Column(type: "text", nullable: true), + TimeOut = table.Column(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"); + } + } +} diff --git a/PARR.DAL/Migrations/20230810231939_TblsAIHIT.Designer.cs b/PARR.DAL/Migrations/20230810231939_TblsAIHIT.Designer.cs new file mode 100644 index 00000000..99be374d --- /dev/null +++ b/PARR.DAL/Migrations/20230810231939_TblsAIHIT.Designer.cs @@ -0,0 +1,740 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("timestamp with time zone"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("timestamp with time zone"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230810231939_TblsAIHIT.cs b/PARR.DAL/Migrations/20230810231939_TblsAIHIT.cs new file mode 100644 index 00000000..545692f4 --- /dev/null +++ b/PARR.DAL/Migrations/20230810231939_TblsAIHIT.cs @@ -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 +{ + /// + public partial class TblsAIHIT : Migration + { + /// + 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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + IP = table.Column(type: "text", nullable: true), + Metka = table.Column(type: "text", nullable: true), + IsActive = table.Column(type: "text", nullable: true), + IsImportant = table.Column(type: "text", nullable: true), + CreateTime = table.Column(type: "timestamp with time zone", nullable: true), + AdditionalInfo = table.Column(type: "text", nullable: true), + ResponseArea = table.Column(type: "text", nullable: true), + EKCategory = table.Column(type: "text", nullable: true), + EKFindCode = table.Column(type: "text", nullable: true), + ProductCode = table.Column(type: "text", nullable: true), + ServiceCode = table.Column(type: "text", nullable: true), + ShortName = table.Column(type: "text", nullable: true), + ResponsibleByEK = table.Column(type: "text", nullable: true), + PlannedTimeToRepair = table.Column(type: "timestamp with time zone", nullable: true), + EKSubCategory = table.Column(type: "text", nullable: true), + FullName = table.Column(type: "text", nullable: true), + Prescription = table.Column(type: "text", nullable: true), + Company = table.Column(type: "text", nullable: true), + WorkGroup = table.Column(type: "text", nullable: true), + Location = table.Column(type: "text", nullable: true), + EKRevizor = table.Column(type: "text", nullable: true), + EKRegister = table.Column(type: "text", nullable: true), + NetworkName = table.Column(type: "text", nullable: true), + Status = table.Column(type: "text", nullable: true), + EKType = table.Column(type: "text", nullable: true), + EndExplotationDate = table.Column(type: "timestamp with time zone", nullable: true), + StartExplotationDate = table.Column(type: "timestamp with time zone", nullable: true), + TargetRepairTime = table.Column(type: "text", nullable: true), + SysModTime = table.Column(type: "timestamp with time zone", nullable: true), + SysModUser = table.Column(type: "text", nullable: true), + NewEKFindCode = table.Column(type: "text", nullable: true), + OldEKFindCode = table.Column(type: "text", nullable: true), + CTSDirection = table.Column(type: "text", nullable: true), + AIHID = table.Column(type: "integer", nullable: true), + IsUnreliableData = table.Column(type: "character(1)", nullable: true), + ShiftWorkGroup = table.Column(type: "text", nullable: true), + ClientSoftware = table.Column(type: "text", nullable: true), + ClientOS = table.Column(type: "text", nullable: true), + DBType = table.Column(type: "text", nullable: true), + APPType = table.Column(type: "text", nullable: true), + CKBSServerType = table.Column(type: "text", nullable: true), + IBServerType = table.Column(type: "text", nullable: true), + InfrastructureServerType = table.Column(type: "text", nullable: true), + MonitoringServerType = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Group = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Settings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "V1_ApplicationTypes", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: true), + V1_ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + HostName = table.Column(type: "text", nullable: true), + IP = table.Column(type: "text", nullable: false), + RegionalEK = table.Column(type: "text", nullable: true), + LinkEK = table.Column(type: "text", nullable: true), + Status = table.Column(type: "text", nullable: true), + WorkGroup = table.Column(type: "text", nullable: true), + Responsible = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + ApplicationId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + ScriptName = table.Column(type: "text", nullable: false), + JobModeId = table.Column(type: "uuid", nullable: false), + JobCategoryId = table.Column(type: "uuid", nullable: true), + JobTypeId = table.Column(type: "uuid", nullable: true), + ApplicationId = table.Column(type: "uuid", nullable: false), + Frequency = table.Column(type: "integer", nullable: false), + StartAt = table.Column(type: "timestamp with time zone", nullable: false), + IsEnabled = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + DateOper = table.Column(type: "timestamp with time zone", nullable: false), + Other = table.Column(type: "text", nullable: true), + TimeOut = table.Column(type: "integer", nullable: true), + Info = table.Column(type: "text", nullable: true), + JobStatusId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(type: "uuid", nullable: false), + JobId = table.Column(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"); + } + + /// + 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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false), + V1_ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + HostName = table.Column(type: "text", nullable: true), + IP = table.Column(type: "text", nullable: false), + LinkEK = table.Column(type: "text", nullable: true), + RegionalEK = table.Column(type: "text", nullable: true), + Responsible = table.Column(type: "text", nullable: true), + Status = table.Column(type: "text", nullable: true), + WorkGroup = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + ApplicationTypeId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(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(type: "uuid", nullable: false), + ApplicationId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(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(type: "uuid", nullable: false), + ApplicationId = table.Column(type: "uuid", nullable: false), + JobCategoryId = table.Column(type: "uuid", nullable: true), + JobModeId = table.Column(type: "uuid", nullable: false), + JobTypeId = table.Column(type: "uuid", nullable: true), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Frequency = table.Column(type: "integer", nullable: false), + IsEnabled = table.Column(type: "boolean", nullable: false), + Name = table.Column(type: "text", nullable: false), + ScriptName = table.Column(type: "text", nullable: false), + StartAt = table.Column(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(type: "uuid", nullable: false), + HostId = table.Column(type: "uuid", nullable: false), + JobId = table.Column(type: "uuid", nullable: false), + JobStatusId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + DateOper = table.Column(type: "timestamp with time zone", nullable: false), + Info = table.Column(type: "text", nullable: true), + Other = table.Column(type: "text", nullable: true), + TimeOut = table.Column(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"); + } + } +} diff --git a/PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.Designer.cs b/PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.Designer.cs new file mode 100644 index 00000000..bcaa5e66 --- /dev/null +++ b/PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.Designer.cs @@ -0,0 +1,740 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("text"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("text"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("text"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("text"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.cs b/PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.cs new file mode 100644 index 00000000..184406ef --- /dev/null +++ b/PARR.DAL/Migrations/20230811071304_TblAIHEKFixDatatype.cs @@ -0,0 +1,135 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class TblAIHEKFixDatatype : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "SysModTime", + schema: "AIHIT", + table: "RawDataEKs", + type: "text", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "StartExplotationDate", + schema: "AIHIT", + table: "RawDataEKs", + type: "text", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "PlannedTimeToRepair", + schema: "AIHIT", + table: "RawDataEKs", + type: "text", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "EndExplotationDate", + schema: "AIHIT", + table: "RawDataEKs", + type: "text", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone", + oldNullable: true); + + migrationBuilder.AlterColumn( + 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-ЗАБ"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "SysModTime", + schema: "AIHIT", + table: "RawDataEKs", + type: "timestamp with time zone", + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "StartExplotationDate", + schema: "AIHIT", + table: "RawDataEKs", + type: "timestamp with time zone", + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "PlannedTimeToRepair", + schema: "AIHIT", + table: "RawDataEKs", + type: "timestamp with time zone", + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "EndExplotationDate", + schema: "AIHIT", + table: "RawDataEKs", + type: "timestamp with time zone", + nullable: true, + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + 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 - ЗАБ"); + } + } +} diff --git a/PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.Designer.cs b/PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.Designer.cs new file mode 100644 index 00000000..40669978 --- /dev/null +++ b/PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.Designer.cs @@ -0,0 +1,749 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("text"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("text"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("text"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("text"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.cs b/PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.cs new file mode 100644 index 00000000..f9955509 --- /dev/null +++ b/PARR.DAL/Migrations/20230814013448_TblAIHSettingsAddValue1.cs @@ -0,0 +1,31 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class TblAIHSettingsAddValue1 : Migration + { + /// + 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-В эксплуатации" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + schema: "AIHIT", + table: "Settings", + keyColumn: "Id", + keyValue: new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346")); + } + } +} diff --git a/PARR.DAL/Migrations/20230814023034_TblHosts.Designer.cs b/PARR.DAL/Migrations/20230814023034_TblHosts.Designer.cs new file mode 100644 index 00000000..f1307bad --- /dev/null +++ b/PARR.DAL/Migrations/20230814023034_TblHosts.Designer.cs @@ -0,0 +1,779 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("text"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("text"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("text"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("text"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230814023034_TblHosts.cs b/PARR.DAL/Migrations/20230814023034_TblHosts.cs new file mode 100644 index 00000000..cb9e2331 --- /dev/null +++ b/PARR.DAL/Migrations/20230814023034_TblHosts.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class TblHosts : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Hosts", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + HostName = table.Column(type: "text", nullable: true), + IP = table.Column(type: "text", nullable: false), + Status = table.Column(type: "text", nullable: true), + WorkGroup = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Hosts", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Hosts"); + } + } +} diff --git a/PARR.DAL/Migrations/20230814030221_TblApplications.Designer.cs b/PARR.DAL/Migrations/20230814030221_TblApplications.Designer.cs new file mode 100644 index 00000000..592c4ed2 --- /dev/null +++ b/PARR.DAL/Migrations/20230814030221_TblApplications.Designer.cs @@ -0,0 +1,779 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("text"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("text"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("text"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("text"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationTypeId"); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.ApplicationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230814030221_TblApplications.cs b/PARR.DAL/Migrations/20230814030221_TblApplications.cs new file mode 100644 index 00000000..e09b4d63 --- /dev/null +++ b/PARR.DAL/Migrations/20230814030221_TblApplications.cs @@ -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 +{ + /// + public partial class TblApplications : Migration + { + /// + 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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: true), + ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + ApplicationTypeId = table.Column(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); + } + + /// + 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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Description = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false), + V1_ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + ApplicationTypeId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(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); + } + } +} diff --git a/PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.Designer.cs b/PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.Designer.cs new file mode 100644 index 00000000..f08b5bb0 --- /dev/null +++ b/PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.Designer.cs @@ -0,0 +1,922 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AIHID") + .HasColumnType("integer"); + + b.Property("APPType") + .HasColumnType("text"); + + b.Property("AdditionalInfo") + .HasColumnType("text"); + + b.Property("CKBSServerType") + .HasColumnType("text"); + + b.Property("CTSDirection") + .HasColumnType("text"); + + b.Property("ClientOS") + .HasColumnType("text"); + + b.Property("ClientSoftware") + .HasColumnType("text"); + + b.Property("Company") + .HasColumnType("text"); + + b.Property("CreateTime") + .HasColumnType("text"); + + b.Property("DBType") + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EKCategory") + .HasColumnType("text"); + + b.Property("EKFindCode") + .HasColumnType("text"); + + b.Property("EKRegister") + .HasColumnType("text"); + + b.Property("EKRevizor") + .HasColumnType("text"); + + b.Property("EKSubCategory") + .HasColumnType("text"); + + b.Property("EKType") + .HasColumnType("text"); + + b.Property("EndExplotationDate") + .HasColumnType("text"); + + b.Property("FullName") + .HasColumnType("text"); + + b.Property("IBServerType") + .HasColumnType("text"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("InfrastructureServerType") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("text"); + + b.Property("IsImportant") + .HasColumnType("text"); + + b.Property("IsUnreliableData") + .HasColumnType("character(1)"); + + b.Property("Location") + .HasColumnType("text"); + + b.Property("Metka") + .HasColumnType("text"); + + b.Property("MonitoringServerType") + .HasColumnType("text"); + + b.Property("NetworkName") + .HasColumnType("text"); + + b.Property("NewEKFindCode") + .HasColumnType("text"); + + b.Property("OldEKFindCode") + .HasColumnType("text"); + + b.Property("PlannedTimeToRepair") + .HasColumnType("text"); + + b.Property("Prescription") + .HasColumnType("text"); + + b.Property("ProductCode") + .HasColumnType("text"); + + b.Property("ResponseArea") + .HasColumnType("text"); + + b.Property("ResponsibleByEK") + .HasColumnType("text"); + + b.Property("ServiceCode") + .HasColumnType("text"); + + b.Property("ShiftWorkGroup") + .HasColumnType("text"); + + b.Property("ShortName") + .HasColumnType("text"); + + b.Property("StartExplotationDate") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("SysModTime") + .HasColumnType("text"); + + b.Property("SysModUser") + .HasColumnType("text"); + + b.Property("TargetRepairTime") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("RawDataEKs", "AIHIT"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Group") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationTypeId"); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("HostId"); + + b.ToTable("ApplicationsInHost"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostName") + .HasColumnType("text"); + + b.Property("IP") + .IsRequired() + .HasColumnType("text"); + + b.Property("LinkEK") + .HasColumnType("text"); + + b.Property("RegionalEK") + .HasColumnType("text"); + + b.Property("Responsible") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("JobCategoryId") + .HasColumnType("uuid"); + + b.Property("JobModeId") + .HasColumnType("uuid"); + + b.Property("JobTypeId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScriptName") + .IsRequired() + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("V1_JobCategorys"); + }); + + modelBuilder.Entity("PARR.DAL.Models.V1.V1_JobJournal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOper") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("Info") + .HasColumnType("text"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("JobStatusId") + .HasColumnType("uuid"); + + b.Property("Other") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("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 + } + } +} diff --git a/PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.cs b/PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.cs new file mode 100644 index 00000000..d152e9fa --- /dev/null +++ b/PARR.DAL/Migrations/20230814052014_TblApplicationsInHost.cs @@ -0,0 +1,147 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class TblApplicationsInHost : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "V1_ApplicationId", + table: "V1_ApplicationsInHost", + type: "uuid", + nullable: true); + + migrationBuilder.CreateTable( + name: "ApplicationsInHost", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + ApplicationId = table.Column(type: "uuid", nullable: false), + HostId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: true), + V1_ApplicationTypeId = table.Column(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(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateModified = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + ApplicationTypeId = table.Column(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"); + } + + /// + 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"); + } + } +} diff --git a/PARR.DAL/Models/AIHIT/RawDataEK.cs b/PARR.DAL/Models/AIHIT/RawDataEK.cs new file mode 100644 index 00000000..8b205c55 --- /dev/null +++ b/PARR.DAL/Models/AIHIT/RawDataEK.cs @@ -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; } + } +} diff --git a/PARR.DAL/Models/AIHIT/Setting.cs b/PARR.DAL/Models/AIHIT/Setting.cs new file mode 100644 index 00000000..3f2ed890 --- /dev/null +++ b/PARR.DAL/Models/AIHIT/Setting.cs @@ -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; } + + + } +} diff --git a/PARR.DAL/Models/Application.cs b/PARR.DAL/Models/Application.cs new file mode 100644 index 00000000..a32e7769 --- /dev/null +++ b/PARR.DAL/Models/Application.cs @@ -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 ApplicationsInHosts { get; set; } = new HashSet(); + //public ICollection Applications { get;set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/ApplicationInHost.cs b/PARR.DAL/Models/ApplicationInHost.cs new file mode 100644 index 00000000..720471b6 --- /dev/null +++ b/PARR.DAL/Models/ApplicationInHost.cs @@ -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; } + } +} diff --git a/PARR.DAL/Models/ApplicationType.cs b/PARR.DAL/Models/ApplicationType.cs new file mode 100644 index 00000000..19da88e1 --- /dev/null +++ b/PARR.DAL/Models/ApplicationType.cs @@ -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 ApplicationTypes { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/Hosts.cs b/PARR.DAL/Models/Hosts.cs new file mode 100644 index 00000000..1b671201 --- /dev/null +++ b/PARR.DAL/Models/Hosts.cs @@ -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 ApplicationsInHosts { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_Application.cs b/PARR.DAL/Models/V1/V1_Application.cs new file mode 100644 index 00000000..0ae1f1d9 --- /dev/null +++ b/PARR.DAL/Models/V1/V1_Application.cs @@ -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_ApplicationsInHosts { get; set; } = new HashSet(); + //public ICollection Applications { get;set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_ApplicationInHost.cs b/PARR.DAL/Models/V1/V1_ApplicationInHost.cs new file mode 100644 index 00000000..292a424e --- /dev/null +++ b/PARR.DAL/Models/V1/V1_ApplicationInHost.cs @@ -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; } + } +} diff --git a/PARR.DAL/Models/V1/V1_ApplicationType.cs b/PARR.DAL/Models/V1/V1_ApplicationType.cs new file mode 100644 index 00000000..872986df --- /dev/null +++ b/PARR.DAL/Models/V1/V1_ApplicationType.cs @@ -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_ApplicationTypes { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_Host.cs b/PARR.DAL/Models/V1/V1_Host.cs new file mode 100644 index 00000000..19b59390 --- /dev/null +++ b/PARR.DAL/Models/V1/V1_Host.cs @@ -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 JobJournals { get; set; } = new HashSet(); + public ICollection ApplicationsInHosts { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_Job.cs b/PARR.DAL/Models/V1/V1_Job.cs new file mode 100644 index 00000000..f3b98d7e --- /dev/null +++ b/PARR.DAL/Models/V1/V1_Job.cs @@ -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; } + /// + /// Частота запуска Job в минутах + /// + public int Frequency { get; set; } + /// + /// В режиме manual значит время регистрации регламентной работы АСУ ЕСПП, в auto - время старта Job. + /// + public DateTimeOffset StartAt { get; set; } + /// + /// Активация Job + /// + public bool IsEnabled { get; set; } + + + public ICollection Journals { get; set; } = new HashSet(); + + } +} diff --git a/PARR.DAL/Models/V1/V1_JobCategory.cs b/PARR.DAL/Models/V1/V1_JobCategory.cs new file mode 100644 index 00000000..aa793de0 --- /dev/null +++ b/PARR.DAL/Models/V1/V1_JobCategory.cs @@ -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; } + /// + /// app, db + /// + public required string Name { get; set; } + public string? Description { get; set; } + + + + public ICollection Jobs { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_JobJournal.cs b/PARR.DAL/Models/V1/V1_JobJournal.cs new file mode 100644 index 00000000..0b985492 --- /dev/null +++ b/PARR.DAL/Models/V1/V1_JobJournal.cs @@ -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; } + } +} diff --git a/PARR.DAL/Models/V1/V1_JobMode.cs b/PARR.DAL/Models/V1/V1_JobMode.cs new file mode 100644 index 00000000..ceae9da9 --- /dev/null +++ b/PARR.DAL/Models/V1/V1_JobMode.cs @@ -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; } + /// + /// manual, auto + /// + public required string Name { get; set; } + + + + public ICollection Jobs { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_JobStatus.cs b/PARR.DAL/Models/V1/V1_JobStatus.cs new file mode 100644 index 00000000..0e66419d --- /dev/null +++ b/PARR.DAL/Models/V1/V1_JobStatus.cs @@ -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; } + /// + /// started, finished, timeout, error + /// + public required string Name { get; set; } + public string? Description { get; set; } + + + + public ICollection Journals { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_JobType.cs b/PARR.DAL/Models/V1/V1_JobType.cs new file mode 100644 index 00000000..788be86b --- /dev/null +++ b/PARR.DAL/Models/V1/V1_JobType.cs @@ -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; } + /// + /// log-rotate, vacuum-psqld + /// + public required string Name { get; set; } + public string? Description { get; set; } + + + public ICollection Jobs { get; set; } = new HashSet(); + } +} diff --git a/PARR.DAL/Models/V1/V1_Scheduler.cs b/PARR.DAL/Models/V1/V1_Scheduler.cs new file mode 100644 index 00000000..05a99b9e --- /dev/null +++ b/PARR.DAL/Models/V1/V1_Scheduler.cs @@ -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; } + //} +} diff --git a/PARR.DAL/Services/Implementations/AIHIT/RawDataEKService.cs b/PARR.DAL/Services/Implementations/AIHIT/RawDataEKService.cs new file mode 100644 index 00000000..eab156ab --- /dev/null +++ b/PARR.DAL/Services/Implementations/AIHIT/RawDataEKService.cs @@ -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, IRawDataEKService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public RawDataEKService(DataContext dataContext, ILogger 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 EntitySet => dataContext.RawDataEKs; + + protected override DataContext EntitiContext => dataContext; + + } +} diff --git a/PARR.DAL/Services/Implementations/AIHIT/SettingService.cs b/PARR.DAL/Services/Implementations/AIHIT/SettingService.cs new file mode 100644 index 00000000..90835493 --- /dev/null +++ b/PARR.DAL/Services/Implementations/AIHIT/SettingService.cs @@ -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, ISettingService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + public SettingService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + + protected override DbSet EntitySet => dataContext.Settings; + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_ApplicationInHostService.cs b/PARR.DAL/Services/Implementations/V1/V1_ApplicationInHostService.cs new file mode 100644 index 00000000..0bf159e1 --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_ApplicationInHostService.cs @@ -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_IApplicationInHostService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_ApplicationInHostService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + + protected override DbSet EntitySet => dataContext.V1_ApplicationsInHosts; + + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_ApplicationService.cs b/PARR.DAL/Services/Implementations/V1/V1_ApplicationService.cs new file mode 100644 index 00000000..2f9dde3e --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_ApplicationService.cs @@ -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_IApplicationService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_ApplicationService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + + protected override DbSet EntitySet => dataContext.V1_Applications; + + protected override DataContext EntitiContext => dataContext; + + public async Task GetByNameAsync(string appName) + { + return await EntitySet.FirstOrDefaultAsync(t => t.Name.ToLower() == appName.Trim().ToLower()); + } + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_ApplicationTypeService.cs b/PARR.DAL/Services/Implementations/V1/V1_ApplicationTypeService.cs new file mode 100644 index 00000000..b0d31a1b --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_ApplicationTypeService.cs @@ -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_IApplicationTypeService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_ApplicationTypeService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + + protected override DbSet EntitySet => dataContext.V1_ApplicationTypes; + + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_HostService.cs b/PARR.DAL/Services/Implementations/V1/V1_HostService.cs new file mode 100644 index 00000000..82c2e831 --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_HostService.cs @@ -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_IHostService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + protected override DbSet EntitySet => dataContext.V1_Hosts; + + protected override DataContext EntitiContext => dataContext; + public V1_HostService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + + public async Task 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 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 GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK) + { + return await EntitySet.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK); + } + + public Task GetAsync(Guid id) + { + throw new NotImplementedException(); + } + + public IQueryable Get() + { + throw new NotImplementedException(); + } + + public IQueryable GetPage(IQueryable query, PaginationFilter paginationFilter) + { + throw new NotImplementedException(); + } + + public Task CreateAsync(V1_Host obj) + { + throw new NotImplementedException(); + } + + public Task AddRangeAsync(List objs) + { + throw new NotImplementedException(); + } + + public Task DeleteAsync(Guid id) + { + throw new NotImplementedException(); + } + + public bool Delete(V1_Host obj) + { + throw new NotImplementedException(); + } + + public Task CommitAsync() + { + throw new NotImplementedException(); + } + + //public async Task GetHostByRegionalEKAsync(string RegionalEK)И + //{ + // try + // { + // var host = await EntitySet.FirstAsync(h => h.RegionalEK == RegionalEK); + // return host; + // } + // catch + // { + // logger.LogInformation($"Не найден узел с региональным ЭК {RegionalEK}"); + // return null; + // } + //} + + //public async Task 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; + // } + + //} + + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_JobCategoryService.cs b/PARR.DAL/Services/Implementations/V1/V1_JobCategoryService.cs new file mode 100644 index 00000000..a9125853 --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_JobCategoryService.cs @@ -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_IJobCategoryService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_JobCategoryService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + protected override DbSet EntitySet => dataContext.JobCategories; + + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_JobJournalService.cs b/PARR.DAL/Services/Implementations/V1/V1_JobJournalService.cs new file mode 100644 index 00000000..319394eb --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_JobJournalService.cs @@ -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_IJobJournalService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_JobJournalService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + protected override DbSet EntitySet => dataContext.JobJournals; + + protected override DataContext EntitiContext => dataContext; + + public async Task 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; + } + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_JobModeService.cs b/PARR.DAL/Services/Implementations/V1/V1_JobModeService.cs new file mode 100644 index 00000000..d63ecd48 --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_JobModeService.cs @@ -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_IJobModeService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_JobModeService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + protected override DbSet EntitySet => dataContext.JobModes; + + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_JobService.cs b/PARR.DAL/Services/Implementations/V1/V1_JobService.cs new file mode 100644 index 00000000..3cfdf2d6 --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_JobService.cs @@ -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_IJobService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_JobService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + protected override DbSet EntitySet => dataContext.Jobs; + + protected override DataContext EntitiContext => dataContext; + + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_JobStatusService.cs b/PARR.DAL/Services/Implementations/V1/V1_JobStatusService.cs new file mode 100644 index 00000000..60524cbf --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_JobStatusService.cs @@ -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_IJobStatusService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public V1_JobStatusService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + protected override DbSet EntitySet => dataContext.JobStatuses; + + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Implementations/V1/V1_SchedulerService.cs b/PARR.DAL/Services/Implementations/V1/V1_SchedulerService.cs new file mode 100644 index 00000000..109da96d --- /dev/null +++ b/PARR.DAL/Services/Implementations/V1/V1_SchedulerService.cs @@ -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, ISchedulerService + //{ + // private readonly DataContext dataContext; + + // public SchedulerService(DataContext dataContext, ILogger logger) : base(logger) + // { + // this.dataContext = dataContext; + // } + // protected override DbSet EntitySet => dataContext.Schedulers; + + // protected override DataContext EntitiContext => dataContext; + //} +} diff --git a/PARR.DAL/Services/Interfaces/AIHIT/IRawDataEKService.cs b/PARR.DAL/Services/Interfaces/AIHIT/IRawDataEKService.cs new file mode 100644 index 00000000..9e973d86 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/AIHIT/IRawDataEKService.cs @@ -0,0 +1,9 @@ +using PARR.DAL.Services.Interfaces.Base; + +namespace PARR.DAL.Services.Interfaces.AIHIT +{ + public interface IRawDataEKService : IBaseService + { + void DeleteAll(); + } +} diff --git a/PARR.DAL/Services/Interfaces/AIHIT/ISettingService.cs b/PARR.DAL/Services/Interfaces/AIHIT/ISettingService.cs new file mode 100644 index 00000000..a2d2a095 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/AIHIT/ISettingService.cs @@ -0,0 +1,8 @@ +using PARR.DAL.Services.Interfaces.Base; + +namespace PARR.DAL.Services.Interfaces.AIHIT +{ + public interface ISettingService : IBaseService + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IApplicationInHostService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IApplicationInHostService.cs new file mode 100644 index 00000000..48eb7ec7 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IApplicationInHostService.cs @@ -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 + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IApplicationService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IApplicationService.cs new file mode 100644 index 00000000..d53814c5 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IApplicationService.cs @@ -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 + { + Task GetByNameAsync(string appName); + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IApplicationTypeService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IApplicationTypeService.cs new file mode 100644 index 00000000..6a433b79 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IApplicationTypeService.cs @@ -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 + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IHostService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IHostService.cs new file mode 100644 index 00000000..fd17e4fd --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IHostService.cs @@ -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 + { + Task GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK); + Task GetHostWithAppsAsync(string IP, string linkEK, string regionalEK); + //Task GetHostByRegionalEKAsync(string LinkEK); + //Task UpdateAsync(Host host); + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IJobCategoryService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IJobCategoryService.cs new file mode 100644 index 00000000..0d9b83b7 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IJobCategoryService.cs @@ -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 + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IJobJournalService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IJobJournalService.cs new file mode 100644 index 00000000..569b92b6 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IJobJournalService.cs @@ -0,0 +1,9 @@ +using PARR.DAL.Models.V1; + +namespace PARR.DAL.Services.Interfaces.V1 +{ + public interface V1_IJobJournalService + { + Task GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date); + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IJobModeService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IJobModeService.cs new file mode 100644 index 00000000..6d4173be --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IJobModeService.cs @@ -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 + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IJobService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IJobService.cs new file mode 100644 index 00000000..dc666114 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IJobService.cs @@ -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 + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_IJobStatusService.cs b/PARR.DAL/Services/Interfaces/V1/V1_IJobStatusService.cs new file mode 100644 index 00000000..99c9c6c1 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_IJobStatusService.cs @@ -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 + { + } +} diff --git a/PARR.DAL/Services/Interfaces/V1/V1_ISchedulerService.cs b/PARR.DAL/Services/Interfaces/V1/V1_ISchedulerService.cs new file mode 100644 index 00000000..3499ba77 --- /dev/null +++ b/PARR.DAL/Services/Interfaces/V1/V1_ISchedulerService.cs @@ -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 + //{ + //} +}