unique index auf user.name
This commit is contained in:
1885
ReallifeGamemode.Database/Migrations/20210405190220_UserNameUniqueIndex.Designer.cs
generated
Normal file
1885
ReallifeGamemode.Database/Migrations/20210405190220_UserNameUniqueIndex.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class UserNameUniqueIndex : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Users_Name",
|
||||||
|
table: "Users",
|
||||||
|
column: "Name",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Users_Name",
|
||||||
|
table: "Users");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1463,6 +1463,9 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
|
|
||||||
b.HasIndex("HouseId");
|
b.HasIndex("HouseId");
|
||||||
|
|
||||||
|
b.HasIndex("Name")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Design;
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@@ -43,10 +45,16 @@ namespace ReallifeGamemode.Database.Models
|
|||||||
.HasIndex(b => b.BusinessId)
|
.HasIndex(b => b.BusinessId)
|
||||||
.IsUnique(true);
|
.IsUnique(true);
|
||||||
|
|
||||||
modelBuilder.Entity<Entities.User>()
|
modelBuilder.Entity<Entities.User>(e =>
|
||||||
.HasIndex(u => u.BusinessId)
|
{
|
||||||
|
e.HasIndex(u => u.BusinessId)
|
||||||
.IsUnique(true);
|
.IsUnique(true);
|
||||||
|
|
||||||
|
e.HasIndex(u => u.Name)
|
||||||
|
.IsUnique(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
modelBuilder.Entity<Entities.ServerVehicle>()
|
modelBuilder.Entity<Entities.ServerVehicle>()
|
||||||
.Property(sv => sv.Active)
|
.Property(sv => sv.Active)
|
||||||
.HasDefaultValue(true);
|
.HasDefaultValue(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user