feat(dal, domain): Для таблице UnitInTemplates добавлена связь с UnitFieldValues. В таблице Templates убраны значения по умолчанию для поле JobId, UnitId.

This commit is contained in:
Mikhail Trubnikov
2026-05-12 16:34:31 +10:00
parent 97964111c3
commit e5900be547
13 changed files with 9618 additions and 1808 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblUnitsInTemplateAddUnitFieldValueId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_UnitsInTemplates",
schema: "job",
table: "UnitsInTemplates");
migrationBuilder.AddColumn<Guid>(
name: "UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates",
type: "uuid",
nullable: false,
defaultValue: new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"));
migrationBuilder.AddPrimaryKey(
name: "PK_UnitsInTemplates",
schema: "job",
table: "UnitsInTemplates",
columns: new[] { "TemplateId", "UnitId", "UnitFieldValueId" });
migrationBuilder.UpdateData(
schema: "task",
table: "Types",
keyColumn: "Code",
keyValue: 0,
column: "MaxExecutionTimeMinutes",
value: 60);
migrationBuilder.CreateIndex(
name: "IX_UnitsInTemplates_UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates",
column: "UnitFieldValueId");
migrationBuilder.AddForeignKey(
name: "FK_UnitsInTemplates_FieldValues_UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates",
column: "UnitFieldValueId",
principalSchema: "unit",
principalTable: "FieldValues",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UnitsInTemplates_FieldValues_UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates");
migrationBuilder.DropPrimaryKey(
name: "PK_UnitsInTemplates",
schema: "job",
table: "UnitsInTemplates");
migrationBuilder.DropIndex(
name: "IX_UnitsInTemplates_UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates");
migrationBuilder.DropColumn(
name: "UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates");
migrationBuilder.AddPrimaryKey(
name: "PK_UnitsInTemplates",
schema: "job",
table: "UnitsInTemplates",
columns: new[] { "TemplateId", "UnitId" });
migrationBuilder.UpdateData(
schema: "task",
table: "Types",
keyColumn: "Code",
keyValue: 0,
column: "MaxExecutionTimeMinutes",
value: 30);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblUnitsInTemplateAddUnitFieldValueIdUnsetDefault : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldDefaultValue: new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"));
migrationBuilder.AlterColumn<Guid>(
name: "JobId",
schema: "public",
table: "Templates",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldDefaultValue: new Guid("ba05948b-b040-48cc-ab77-0accc9c223a0"));
migrationBuilder.AlterColumn<Guid>(
name: "UnitId",
schema: "public",
table: "Templates",
type: "uuid",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uuid",
oldDefaultValue: new Guid("b4dfd71a-2b2f-414f-8409-4b9abd9c4d2c"));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "UnitFieldValueId",
schema: "job",
table: "UnitsInTemplates",
type: "uuid",
nullable: false,
defaultValue: new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"),
oldClrType: typeof(Guid),
oldType: "uuid");
}
}
}

File diff suppressed because it is too large Load Diff