БД, таблицы для ЕСПП, связь с app, обновлена Template
This commit is contained in:
1305
PARR.DAL/Migrations/20230918234448_TblsEsppWorksAndAppsAndTEmpl.Designer.cs
generated
Normal file
1305
PARR.DAL/Migrations/20230918234448_TblsEsppWorksAndAppsAndTEmpl.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,210 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblsEsppWorksAndAppsAndTEmpl : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ApplicationInWorkId",
|
||||
table: "Templates",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Processes",
|
||||
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),
|
||||
EsppId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Processes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Subprocesses",
|
||||
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),
|
||||
EsppId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProcessId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Subprocesses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Subprocesses_Processes_ProcessId",
|
||||
column: x => x.ProcessId,
|
||||
principalTable: "Processes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tnks",
|
||||
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),
|
||||
EsppId = table.Column<int>(type: "integer", nullable: false),
|
||||
SubprocessId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tnks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Tnks_Subprocesses_SubprocessId",
|
||||
column: x => x.SubprocessId,
|
||||
principalTable: "Subprocesses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Works",
|
||||
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),
|
||||
EsppId = table.Column<int>(type: "integer", nullable: false),
|
||||
TnkId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Works", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Works_Tnks_TnkId",
|
||||
column: x => x.TnkId,
|
||||
principalTable: "Tnks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApplicationsInWorks",
|
||||
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),
|
||||
WorkId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApplicationsInWorks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ApplicationsInWorks_Applications_ApplicationId",
|
||||
column: x => x.ApplicationId,
|
||||
principalTable: "Applications",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ApplicationsInWorks_Works_WorkId",
|
||||
column: x => x.WorkId,
|
||||
principalTable: "Works",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Templates_ApplicationInWorkId",
|
||||
table: "Templates",
|
||||
column: "ApplicationInWorkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Templates_Name",
|
||||
table: "Templates",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApplicationsInWorks_ApplicationId",
|
||||
table: "ApplicationsInWorks",
|
||||
column: "ApplicationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApplicationsInWorks_WorkId_ApplicationId",
|
||||
table: "ApplicationsInWorks",
|
||||
columns: new[] { "WorkId", "ApplicationId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Subprocesses_ProcessId",
|
||||
table: "Subprocesses",
|
||||
column: "ProcessId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Tnks_SubprocessId",
|
||||
table: "Tnks",
|
||||
column: "SubprocessId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Works_TnkId",
|
||||
table: "Works",
|
||||
column: "TnkId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Templates_ApplicationsInWorks_ApplicationInWorkId",
|
||||
table: "Templates",
|
||||
column: "ApplicationInWorkId",
|
||||
principalTable: "ApplicationsInWorks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Templates_ApplicationsInWorks_ApplicationInWorkId",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApplicationsInWorks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Works");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tnks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Subprocesses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Processes");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Templates_ApplicationInWorkId",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Templates_Name",
|
||||
table: "Templates");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApplicationInWorkId",
|
||||
table: "Templates");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,6 +347,34 @@ namespace PARR.DAL.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", 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>("WorkId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("WorkId", "ApplicationId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ApplicationsInWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -377,6 +405,30 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("Hosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Process", 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<int>("EsppId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Processes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
|
||||
{
|
||||
b.Property<int>("Code")
|
||||
@@ -418,12 +470,44 @@ namespace PARR.DAL.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Subprocess", 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<int>("EsppId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ProcessId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProcessId");
|
||||
|
||||
b.ToTable("Subprocesses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Template", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationInWorkId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
@@ -502,11 +586,45 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationInWorkId");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("StatusCode");
|
||||
|
||||
b.ToTable("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Tnk", 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<int>("EsppId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("SubprocessId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SubprocessId");
|
||||
|
||||
b.ToTable("Tnks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -854,6 +972,35 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("V1_JobTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Work", 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<int>("EsppId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("TnkId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TnkId");
|
||||
|
||||
b.ToTable("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
|
||||
@@ -891,17 +1038,66 @@ namespace PARR.DAL.Migrations
|
||||
.HasForeignKey("ApplicationTypeId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
.WithMany("ApplicationsInWorks")
|
||||
.HasForeignKey("ApplicationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Work", "Work")
|
||||
.WithMany("ApplicationsInWorks")
|
||||
.HasForeignKey("WorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
b.Navigation("Work");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Process", "Process")
|
||||
.WithMany("Subprocesses")
|
||||
.HasForeignKey("ProcessId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Process");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Template", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("ApplicationInWorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.StatusTemplate", "StatusTemplate")
|
||||
.WithMany("Templates")
|
||||
.HasForeignKey("StatusCode")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ApplicationsInWork");
|
||||
|
||||
b.Navigation("StatusTemplate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Subprocess", "Subprocess")
|
||||
.WithMany("Tnks")
|
||||
.HasForeignKey("SubprocessId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Subprocess");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
|
||||
@@ -1001,9 +1197,22 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Tnk", "Tnk")
|
||||
.WithMany("Works")
|
||||
.HasForeignKey("TnkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Tnk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
|
||||
b.Navigation("ApplicationsInWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||
@@ -1011,16 +1220,36 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("ApplicationTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b =>
|
||||
{
|
||||
b.Navigation("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Process", b =>
|
||||
{
|
||||
b.Navigation("Subprocesses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
|
||||
{
|
||||
b.Navigation("Templates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
|
||||
{
|
||||
b.Navigation("Tnks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
|
||||
{
|
||||
b.Navigation("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
|
||||
{
|
||||
b.Navigation("V1_ApplicationsInHosts");
|
||||
@@ -1062,6 +1291,11 @@ namespace PARR.DAL.Migrations
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInWorks");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user