feat(dal): Applications добавлен уникальный ключ на поле Name
This commit is contained in:
2874
PARR.DAL/Migrations/20240205055825_tblApplicationAddIndexNameClmn.Designer.cs
generated
Normal file
2874
PARR.DAL/Migrations/20240205055825_tblApplicationAddIndexNameClmn.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblApplicationAddIndexNameClmn : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "IP",
|
||||
table: "Hosts",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Applications_Name",
|
||||
table: "Applications",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Applications_Name",
|
||||
table: "Applications");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "IP",
|
||||
table: "Hosts",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -459,6 +459,9 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Applications");
|
||||
});
|
||||
|
||||
@@ -1621,7 +1624,6 @@ namespace PARR.DAL.Migrations
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("IP")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastLogon")
|
||||
|
||||
@@ -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("Applications")]
|
||||
[Index(nameof(Name), IsUnique = true)]
|
||||
public class Application : IBase
|
||||
{
|
||||
[Key]
|
||||
|
||||
Reference in New Issue
Block a user