feat(dal): в таблице Hosts поле Ek сделано уникальным

This commit is contained in:
Mikhail Trubnikov
2024-06-05 08:15:12 +10:00
parent 4bb70e965f
commit 6d8fed793e
4 changed files with 2781 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblHostsEkIsUnique : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Hosts_Ek_IP",
table: "Hosts");
migrationBuilder.CreateIndex(
name: "IX_Hosts_Ek",
table: "Hosts",
column: "Ek",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Hosts_IP",
table: "Hosts",
column: "IP");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Hosts_Ek",
table: "Hosts");
migrationBuilder.DropIndex(
name: "IX_Hosts_IP",
table: "Hosts");
migrationBuilder.CreateIndex(
name: "IX_Hosts_Ek_IP",
table: "Hosts",
columns: new[] { "Ek", "IP" });
}
}
}

View File

@@ -1419,14 +1419,17 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.HasIndex("Ek")
.IsUnique();
b.HasIndex("EkStatusCode");
b.HasIndex("IP");
b.HasIndex("ResponseAreaCode");
b.HasIndex("WorkGroupId");
b.HasIndex("Ek", "IP");
b.ToTable("Hosts");
});

View File

@@ -6,7 +6,8 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Hosts")]
[Index(nameof(Ek), nameof(IP))]
[Index(nameof(IP))]
[Index(nameof(Ek), IsUnique = true)]
public class Host : IBase
{
[Key]