feat(dal,api): удалены таблицы которые относились к старому JobAutoControl. Добавлена новая таблица JobAutoControl

This commit is contained in:
Mikhail Trubnikov
2025-12-05 14:07:48 +10:00
parent 8541d7495b
commit 54ccd2e8e3
26 changed files with 8446 additions and 725 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,116 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class remOldJobAutoControl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "JobAutoControlInEkStatus");
migrationBuilder.DropTable(
name: "JobEkMasks");
migrationBuilder.DropTable(
name: "JobAutoControls");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "JobAutoControls",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationInWorkId = table.Column<Guid>(type: "uuid", nullable: false),
Activate = table.Column<bool>(type: "boolean", nullable: false),
CreateNew = table.Column<bool>(type: "boolean", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Deactivate = table.Column<bool>(type: "boolean", nullable: false),
OffScheduleIsActive = table.Column<bool>(type: "boolean", nullable: false),
OffTemplateIsActive = table.Column<bool>(type: "boolean", nullable: false),
OnScheduleIsActive = table.Column<bool>(type: "boolean", nullable: false),
OnTemplateIsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobAutoControls", x => x.Id);
table.ForeignKey(
name: "FK_JobAutoControls_ApplicationsInWorks_ApplicationInWorkId",
column: x => x.ApplicationInWorkId,
principalTable: "ApplicationsInWorks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JobAutoControlInEkStatus",
columns: table => new
{
JobAutoControlId = table.Column<Guid>(type: "uuid", nullable: false),
EkStatusCode = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobAutoControlInEkStatus", x => new { x.JobAutoControlId, x.EkStatusCode });
table.ForeignKey(
name: "FK_JobAutoControlInEkStatus_EkStatuses_EkStatusCode",
column: x => x.EkStatusCode,
principalTable: "EkStatuses",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_JobAutoControlInEkStatus_JobAutoControls_JobAutoControlId",
column: x => x.JobAutoControlId,
principalTable: "JobAutoControls",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "JobEkMasks",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
JobAutoControlId = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobEkMasks", x => x.Id);
table.ForeignKey(
name: "FK_JobEkMasks_JobAutoControls_JobAutoControlId",
column: x => x.JobAutoControlId,
principalTable: "JobAutoControls",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_JobAutoControlInEkStatus_EkStatusCode",
table: "JobAutoControlInEkStatus",
column: "EkStatusCode");
migrationBuilder.CreateIndex(
name: "IX_JobAutoControls_ApplicationInWorkId",
table: "JobAutoControls",
column: "ApplicationInWorkId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_JobEkMasks_JobAutoControlId_Name",
table: "JobEkMasks",
columns: new[] { "JobAutoControlId", "Name" },
unique: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tbjJobAutoControl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AutoControls",
schema: "job",
columns: table => new
{
JobId = table.Column<Guid>(type: "uuid", nullable: false),
IsEnable = table.Column<bool>(type: "boolean", nullable: false),
SyncIsActiveTemplate = table.Column<bool>(type: "boolean", nullable: false),
SyncIsActiveSchedule = table.Column<bool>(type: "boolean", nullable: false),
UpdateIsActiveTemplate = table.Column<bool>(type: "boolean", nullable: false),
UpdateIsActiveSchedule = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AutoControls", x => x.JobId);
table.ForeignKey(
name: "FK_AutoControls_Jobs_JobId",
column: x => x.JobId,
principalSchema: "job",
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица управления автоконтролем для работ");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AutoControls",
schema: "job");
}
}
}

View File

@@ -1597,6 +1597,34 @@ namespace PARR.DAL.Migrations
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobAutoControl", b =>
{
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<bool>("IsEnable")
.HasColumnType("boolean");
b.Property<bool>("SyncIsActiveSchedule")
.HasColumnType("boolean");
b.Property<bool>("SyncIsActiveTemplate")
.HasColumnType("boolean");
b.Property<bool>("UpdateIsActiveSchedule")
.HasColumnType("boolean");
b.Property<bool>("UpdateIsActiveTemplate")
.HasColumnType("boolean");
b.HasKey("JobId");
b.ToTable("AutoControls", "job", t =>
{
t.HasComment("Таблица управления автоконтролем для работ");
});
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobFieldFilter", b =>
{
b.Property<Guid>("Id")
@@ -1808,89 +1836,6 @@ namespace PARR.DAL.Migrations
});
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("Activate")
.HasColumnType("boolean");
b.Property<Guid>("ApplicationInWorkId")
.HasColumnType("uuid");
b.Property<bool>("CreateNew")
.HasColumnType("boolean");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<bool>("Deactivate")
.HasColumnType("boolean");
b.Property<bool>("OffScheduleIsActive")
.HasColumnType("boolean");
b.Property<bool>("OffTemplateIsActive")
.HasColumnType("boolean");
b.Property<bool>("OnScheduleIsActive")
.HasColumnType("boolean");
b.Property<bool>("OnTemplateIsActive")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("ApplicationInWorkId")
.IsUnique();
b.ToTable("JobAutoControls");
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControlInEkStatus", b =>
{
b.Property<Guid>("JobAutoControlId")
.HasColumnType("uuid");
b.Property<int>("EkStatusCode")
.HasColumnType("integer");
b.HasKey("JobAutoControlId", "EkStatusCode");
b.HasIndex("EkStatusCode");
b.ToTable("JobAutoControlInEkStatus");
});
modelBuilder.Entity("PARR.DAL.Models.JobEkMask", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("JobAutoControlId")
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("JobAutoControlId", "Name")
.IsUnique();
b.ToTable("JobEkMasks");
});
modelBuilder.Entity("PARR.DAL.Models.Order", b =>
{
b.Property<Guid>("Id")
@@ -3399,6 +3344,17 @@ namespace PARR.DAL.Migrations
b.Navigation("Tnk");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobAutoControl", b =>
{
b.HasOne("PARR.DAL.Models.Job.Job", "Job")
.WithOne("AutoControl")
.HasForeignKey("PARR.DAL.Models.Job.JobAutoControl", "JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Job");
});
modelBuilder.Entity("PARR.DAL.Models.Job.JobFieldFilter", b =>
{
b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField")
@@ -3459,47 +3415,6 @@ namespace PARR.DAL.Migrations
b.Navigation("Job");
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork")
.WithOne("JobAutoControl")
.HasForeignKey("PARR.DAL.Models.JobAutoControl", "ApplicationInWorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationsInWork");
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControlInEkStatus", b =>
{
b.HasOne("PARR.DAL.Models.EkStatus", "EkStatus")
.WithMany("JobAutoControlInEkStatuses")
.HasForeignKey("EkStatusCode")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobAutoControl", "JobAutoControl")
.WithMany("JobAutoControlInEkStatuses")
.HasForeignKey("JobAutoControlId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EkStatus");
b.Navigation("JobAutoControl");
});
modelBuilder.Entity("PARR.DAL.Models.JobEkMask", b =>
{
b.HasOne("PARR.DAL.Models.JobAutoControl", "JobAutoControl")
.WithMany("JobEkMasks")
.HasForeignKey("JobAutoControlId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("JobAutoControl");
});
modelBuilder.Entity("PARR.DAL.Models.Order", b =>
{
b.HasOne("PARR.DAL.Models.OrderStatus", "NextStatus")
@@ -3808,8 +3723,6 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b =>
{
b.Navigation("JobAutoControl");
b.Navigation("WorkGroups");
});
@@ -3826,8 +3739,6 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.EkStatus", b =>
{
b.Navigation("Hosts");
b.Navigation("JobAutoControlInEkStatuses");
});
modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b =>
@@ -3859,6 +3770,8 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
{
b.Navigation("AutoControl");
b.Navigation("Templates");
b.Navigation("UnitFilters");
@@ -3883,13 +3796,6 @@ namespace PARR.DAL.Migrations
b.Navigation("RelationshipFilters");
});
modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b =>
{
b.Navigation("JobAutoControlInEkStatuses");
b.Navigation("JobEkMasks");
});
modelBuilder.Entity("PARR.DAL.Models.Order", b =>
{
b.Navigation("AgentHistories");