feat(dal): в таблице Hosts поле Ek сделано уникальным
This commit is contained in:
2728
PARR.DAL/Migrations/20240604221258_tblHostsEkIsUnique.Designer.cs
generated
Normal file
2728
PARR.DAL/Migrations/20240604221258_tblHostsEkIsUnique.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
PARR.DAL/Migrations/20240604221258_tblHostsEkIsUnique.cs
Normal file
46
PARR.DAL/Migrations/20240604221258_tblHostsEkIsUnique.cs
Normal 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" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1419,14 +1419,17 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Ek")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.HasIndex("EkStatusCode");
|
b.HasIndex("EkStatusCode");
|
||||||
|
|
||||||
|
b.HasIndex("IP");
|
||||||
|
|
||||||
b.HasIndex("ResponseAreaCode");
|
b.HasIndex("ResponseAreaCode");
|
||||||
|
|
||||||
b.HasIndex("WorkGroupId");
|
b.HasIndex("WorkGroupId");
|
||||||
|
|
||||||
b.HasIndex("Ek", "IP");
|
|
||||||
|
|
||||||
b.ToTable("Hosts");
|
b.ToTable("Hosts");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
namespace PARR.DAL.Models
|
namespace PARR.DAL.Models
|
||||||
{
|
{
|
||||||
[Table("Hosts")]
|
[Table("Hosts")]
|
||||||
[Index(nameof(Ek), nameof(IP))]
|
[Index(nameof(IP))]
|
||||||
|
[Index(nameof(Ek), IsUnique = true)]
|
||||||
public class Host : IBase
|
public class Host : IBase
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
|||||||
Reference in New Issue
Block a user