feat(bll, dal): distributionPeriod - добавили типы, адаптировали методы
This commit is contained in:
2931
PARR.DAL/Migrations/20240701061944_tblDistributionPerioadAddTypes.Designer.cs
generated
Normal file
2931
PARR.DAL/Migrations/20240701061944_tblDistributionPerioadAddTypes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblDistributionPerioadAddTypes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Duration",
|
||||
table: "DistributionPeriods",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
oldClrType: typeof(TimeSpan),
|
||||
oldType: "interval");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Type",
|
||||
table: "DistributionPeriods",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DistributionPeriodTypes",
|
||||
columns: table => new
|
||||
{
|
||||
Type = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DistributionPeriodTypes", x => x.Type);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "DistributionPeriodTypes",
|
||||
columns: new[] { "Type", "Description" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ "Day", "День" },
|
||||
{ "Month", "Месяц" },
|
||||
{ "TimeSpan", "TimeSpan" },
|
||||
{ "Year", "Год" }
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DistributionPeriods",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"),
|
||||
columns: new[] { "Duration", "Type" },
|
||||
values: new object[] { "90", "Day" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DistributionPeriods",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"),
|
||||
columns: new[] { "Duration", "Type" },
|
||||
values: new object[] { "1", "Month" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DistributionPeriods_Type",
|
||||
table: "DistributionPeriods",
|
||||
column: "Type");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DistributionPeriods_DistributionPeriodTypes_Type",
|
||||
table: "DistributionPeriods",
|
||||
column: "Type",
|
||||
principalTable: "DistributionPeriodTypes",
|
||||
principalColumn: "Type",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DistributionPeriods_DistributionPeriodTypes_Type",
|
||||
table: "DistributionPeriods");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DistributionPeriodTypes");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_DistributionPeriods_Type",
|
||||
table: "DistributionPeriods");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Type",
|
||||
table: "DistributionPeriods");
|
||||
|
||||
migrationBuilder.AlterColumn<TimeSpan>(
|
||||
name: "Duration",
|
||||
table: "DistributionPeriods",
|
||||
type: "interval",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DistributionPeriods",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"),
|
||||
column: "Duration",
|
||||
value: new TimeSpan(90, 0, 0, 0, 0));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DistributionPeriods",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"),
|
||||
column: "Duration",
|
||||
value: new TimeSpan(28, 0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
2926
PARR.DAL/Migrations/20240701065100_tblDistributionPeriodTypeRemoveTimeSpan.Designer.cs
generated
Normal file
2926
PARR.DAL/Migrations/20240701065100_tblDistributionPeriodTypeRemoveTimeSpan.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblDistributionPeriodTypeRemoveTimeSpan : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "DistributionPeriodTypes",
|
||||
keyColumn: "Type",
|
||||
keyValue: "TimeSpan");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "DistributionPeriodTypes",
|
||||
columns: new[] { "Type", "Description" },
|
||||
values: new object[] { "TimeSpan", "TimeSpan" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,29 +309,69 @@ namespace PARR.DAL.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<TimeSpan>("Duration")
|
||||
.HasColumnType("interval");
|
||||
b.Property<string>("Duration")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Type");
|
||||
|
||||
b.ToTable("DistributionPeriods");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"),
|
||||
Duration = new TimeSpan(28, 0, 0, 0, 0),
|
||||
Name = "Ежемесячно"
|
||||
Duration = "1",
|
||||
Name = "Ежемесячно",
|
||||
Type = "Month"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"),
|
||||
Duration = new TimeSpan(90, 0, 0, 0, 0),
|
||||
Name = "Каждые 90 дней"
|
||||
Duration = "90",
|
||||
Name = "Каждые 90 дней",
|
||||
Type = "Day"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.DistributionPeriodType", b =>
|
||||
{
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Type");
|
||||
|
||||
b.ToTable("DistributionPeriodTypes");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Type = "Day",
|
||||
Description = "День"
|
||||
},
|
||||
new
|
||||
{
|
||||
Type = "Month",
|
||||
Description = "Месяц"
|
||||
},
|
||||
new
|
||||
{
|
||||
Type = "Year",
|
||||
Description = "Год"
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2450,6 +2490,17 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("Work");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.DistributionPeriodType", "DistributionPeriodType")
|
||||
.WithMany("Periods")
|
||||
.HasForeignKey("Type")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DistributionPeriodType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType")
|
||||
@@ -2736,6 +2787,11 @@ namespace PARR.DAL.Migrations
|
||||
b.Navigation("EsppSchTypeValues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.DistributionPeriodType", b =>
|
||||
{
|
||||
b.Navigation("Periods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.EkStatus", b =>
|
||||
{
|
||||
b.Navigation("Hosts");
|
||||
|
||||
Reference in New Issue
Block a user