feat(dal): таблица WeekendDays поле Date - уникальное значение

This commit is contained in:
Mikhail Trubnikov
2024-09-13 12:06:51 +10:00
parent 60403ccbf9
commit add572f438
4 changed files with 3101 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblWeekendDaysAddUnique : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_WeekendDays_Date",
table: "WeekendDays",
column: "Date",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_WeekendDays_Date",
table: "WeekendDays");
}
}
}

View File

@@ -2422,6 +2422,9 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.HasIndex("Date")
.IsUnique();
b.ToTable("WeekendDays");
});

View File

@@ -1,10 +1,12 @@
using PARR.DAL.Models.Base;
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("WeekendDays")]
[Index(nameof(Date), IsUnique = true)]
public class WeekendDay : IBase
{
[Key]