This commit is contained in:
Mikhail Kuznetsov
2023-06-16 15:00:11 +10:00
parent 73a824057b
commit 57fe9eff09
37 changed files with 1151 additions and 504 deletions

View File

@@ -1,315 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;
#nullable disable
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230519051342_AllTbls")]
partial class AllTbls
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EK")
.HasColumnType("text");
b.Property<string>("HostName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IP")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Hosts");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
.HasColumnType("uuid");
b.Property<Guid>("JobTypeId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
b.HasIndex("JobTypeId");
b.ToTable("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("JobCategories");
});
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("DateOper")
.HasColumnType("text");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.Property<string>("Info")
.HasColumnType("text");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<Guid>("JobStatusId")
.HasColumnType("uuid");
b.Property<string>("Other")
.HasColumnType("text");
b.Property<int?>("TimeOut")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("HostId");
b.HasIndex("JobId");
b.HasIndex("JobStatusId");
b.ToTable("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.JobModeService", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("JobModes");
});
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("JobStatuses");
});
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
{
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobModeService", "JobModeService")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("JobCategorye");
b.Navigation("JobModeService");
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Host");
b.Navigation("Job");
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobModeService", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
{
b.Navigation("Jobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,98 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class UpdTblHosts : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "EK",
table: "Hosts",
newName: "WorkGroup");
migrationBuilder.AddColumn<string>(
name: "APP",
table: "Hosts",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DB",
table: "Hosts",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LinkEK",
table: "Hosts",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "OS",
table: "Hosts",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RegionalEK",
table: "Hosts",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Responsible",
table: "Hosts",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Status",
table: "Hosts",
type: "text",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "APP",
table: "Hosts");
migrationBuilder.DropColumn(
name: "DB",
table: "Hosts");
migrationBuilder.DropColumn(
name: "LinkEK",
table: "Hosts");
migrationBuilder.DropColumn(
name: "OS",
table: "Hosts");
migrationBuilder.DropColumn(
name: "RegionalEK",
table: "Hosts");
migrationBuilder.DropColumn(
name: "Responsible",
table: "Hosts");
migrationBuilder.DropColumn(
name: "Status",
table: "Hosts");
migrationBuilder.RenameColumn(
name: "WorkGroup",
table: "Hosts",
newName: "EK");
}
}
}

View File

@@ -12,8 +12,8 @@ using PARR.DAL.Context;
namespace PARR.DAL.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20230601014714_UpdTblHosts")]
partial class UpdTblHosts
[Migration("20230616045916_DbV2")]
partial class DbV2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -25,18 +25,117 @@ namespace PARR.DAL.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("APP")
b.Property<Guid?>("ApplicationId")
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DB")
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("ApplicationTypeId");
b.ToTable("Applications");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
@@ -44,7 +143,6 @@ namespace PARR.DAL.Migrations
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IP")
@@ -54,9 +152,6 @@ namespace PARR.DAL.Migrations
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("OS")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
@@ -80,13 +175,16 @@ namespace PARR.DAL.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("JobCategoryId")
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
@@ -99,8 +197,14 @@ namespace PARR.DAL.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
@@ -178,7 +282,7 @@ namespace PARR.DAL.Migrations
b.ToTable("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.JobModeService", b =>
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -197,6 +301,20 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("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.JobStatus", b =>
@@ -247,15 +365,82 @@ namespace PARR.DAL.Migrations
b.ToTable("JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
modelBuilder.Entity("PARR.DAL.Models.Scheduler", b =>
{
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId")
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Schedulers");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.HasOne("PARR.DAL.Models.Application", null)
.WithMany("Applications")
.HasForeignKey("ApplicationId");
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobModeService", "JobModeService")
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.Job", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
@@ -267,9 +452,11 @@ namespace PARR.DAL.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobModeService");
b.Navigation("JobMode");
b.Navigation("JobType");
});
@@ -301,8 +488,17 @@ namespace PARR.DAL.Migrations
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.Navigation("Applications");
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
@@ -316,7 +512,7 @@ namespace PARR.DAL.Migrations
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobModeService", b =>
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
{
b.Navigation("Jobs");
});

View File

@@ -3,14 +3,31 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class AllTbls : Migration
public partial class DbV2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ApplicationTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Hosts",
columns: table => new
@@ -18,9 +35,13 @@ namespace PARR.DAL.Migrations
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
HostName = table.Column<string>(type: "text", nullable: false),
HostName = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: false),
EK = table.Column<string>(type: "text", nullable: true)
RegionalEK = table.Column<string>(type: "text", nullable: true),
LinkEK = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true),
Responsible = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
@@ -86,6 +107,77 @@ namespace PARR.DAL.Migrations
table.PrimaryKey("PK_JobTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Schedulers",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: true),
Frequency = table.Column<int>(type: "integer", nullable: false),
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Schedulers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Applications",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ApplicationTypeId = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: true)
},
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);
table.ForeignKey(
name: "FK_Applications_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ApplicationsInHosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false),
HostId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_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
@@ -94,19 +186,26 @@ namespace PARR.DAL.Migrations
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
ScriptName = table.Column<string>(type: "text", nullable: false),
JobModeId = table.Column<Guid>(type: "uuid", nullable: false),
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: false),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: false)
JobCategoryId = table.Column<Guid>(type: "uuid", nullable: true),
JobTypeId = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", 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",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
table.ForeignKey(
name: "FK_Jobs_JobModes_JobModeId",
column: x => x.JobModeId,
@@ -159,6 +258,45 @@ namespace PARR.DAL.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "ApplicationTypes",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
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" },
{ 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" },
{ 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" }
});
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.CreateIndex(
name: "IX_Applications_ApplicationId",
table: "Applications",
column: "ApplicationId");
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",
@@ -174,6 +312,11 @@ namespace PARR.DAL.Migrations
table: "JobJournals",
column: "JobStatusId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_ApplicationId",
table: "Jobs",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_JobCategoryId",
table: "Jobs",
@@ -193,9 +336,15 @@ namespace PARR.DAL.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ApplicationsInHosts");
migrationBuilder.DropTable(
name: "JobJournals");
migrationBuilder.DropTable(
name: "Schedulers");
migrationBuilder.DropTable(
name: "Hosts");
@@ -205,6 +354,9 @@ namespace PARR.DAL.Migrations
migrationBuilder.DropTable(
name: "Jobs");
migrationBuilder.DropTable(
name: "Applications");
migrationBuilder.DropTable(
name: "JobCategories");
@@ -213,6 +365,9 @@ namespace PARR.DAL.Migrations
migrationBuilder.DropTable(
name: "JobTypes");
migrationBuilder.DropTable(
name: "ApplicationTypes");
}
}
}

View File

@@ -22,18 +22,117 @@ namespace PARR.DAL.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("APP")
b.Property<Guid?>("ApplicationId")
.HasColumnType("uuid");
b.Property<Guid>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DB")
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("ApplicationTypeId");
b.ToTable("Applications");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("HostId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("HostId");
b.ToTable("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ApplicationTypes");
b.HasData(
new
{
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СП xml АИХ ИТ",
Name = "APP"
},
new
{
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле ОС xml АИХ ИТ",
Name = "OS"
},
new
{
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Поле СУБД xml АИХ ИТ",
Name = "DB"
});
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
@@ -41,7 +140,6 @@ namespace PARR.DAL.Migrations
.HasColumnType("timestamp with time zone");
b.Property<string>("HostName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IP")
@@ -51,9 +149,6 @@ namespace PARR.DAL.Migrations
b.Property<string>("LinkEK")
.HasColumnType("text");
b.Property<string>("OS")
.HasColumnType("text");
b.Property<string>("RegionalEK")
.HasColumnType("text");
@@ -77,13 +172,16 @@ namespace PARR.DAL.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("JobCategoryId")
b.Property<Guid?>("JobCategoryId")
.HasColumnType("uuid");
b.Property<Guid>("JobModeId")
@@ -96,8 +194,14 @@ namespace PARR.DAL.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("ScriptName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("JobCategoryId");
b.HasIndex("JobModeId");
@@ -175,7 +279,7 @@ namespace PARR.DAL.Migrations
b.ToTable("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.JobModeService", b =>
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -194,6 +298,20 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("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.JobStatus", b =>
@@ -244,15 +362,82 @@ namespace PARR.DAL.Migrations
b.ToTable("JobTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
modelBuilder.Entity("PARR.DAL.Models.Scheduler", b =>
{
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId")
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("Frequency")
.HasColumnType("integer");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<DateTimeOffset>("StartAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Schedulers");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.HasOne("PARR.DAL.Models.Application", null)
.WithMany("Applications")
.HasForeignKey("ApplicationId");
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobModeService", "JobModeService")
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.Job", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
@@ -264,9 +449,11 @@ namespace PARR.DAL.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("JobCategorye");
b.Navigation("JobModeService");
b.Navigation("JobMode");
b.Navigation("JobType");
});
@@ -298,8 +485,17 @@ namespace PARR.DAL.Migrations
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.Navigation("Applications");
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
@@ -313,7 +509,7 @@ namespace PARR.DAL.Migrations
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobModeService", b =>
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
{
b.Navigation("Jobs");
});