hopefully fix issue with linked banned players
This commit is contained in:
parent
f03666c98d
commit
8fd0bd0dac
@ -118,7 +118,7 @@ namespace Data.Context
|
|||||||
ent.HasIndex(a => a.Name);
|
ent.HasIndex(a => a.Name);
|
||||||
ent.Property(_alias => _alias.SearchableName).HasMaxLength(24);
|
ent.Property(_alias => _alias.SearchableName).HasMaxLength(24);
|
||||||
ent.HasIndex(_alias => _alias.SearchableName);
|
ent.HasIndex(_alias => _alias.SearchableName);
|
||||||
ent.HasIndex(_alias => new {_alias.Name, _alias.IPAddress}).IsUnique();
|
ent.HasIndex(_alias => new {_alias.Name, _alias.IPAddress});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<EFMeta>(ent =>
|
modelBuilder.Entity<EFMeta>(ent =>
|
||||||
@ -145,4 +145,4 @@ namespace Data.Context
|
|||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1449
Data/Migrations/MySql/20220102221729_RemoveUniqueAliasIndexConstraint.Designer.cs
generated
Normal file
1449
Data/Migrations/MySql/20220102221729_RemoveUniqueAliasIndexConstraint.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Data.Migrations.MySql
|
||||||
|
{
|
||||||
|
public partial class RemoveUniqueAliasIndexConstraint : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias",
|
||||||
|
columns: new[] { "Name", "IPAddress" });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias",
|
||||||
|
columns: new[] { "Name", "IPAddress" },
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -816,8 +816,7 @@ namespace Data.Migrations.MySql
|
|||||||
|
|
||||||
b.HasIndex("SearchableName");
|
b.HasIndex("SearchableName");
|
||||||
|
|
||||||
b.HasIndex("Name", "IPAddress")
|
b.HasIndex("Name", "IPAddress");
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("EFAlias");
|
b.ToTable("EFAlias");
|
||||||
});
|
});
|
||||||
|
1477
Data/Migrations/Postgresql/20220102221801_RemoveUniqueAliasIndexConstraint.Designer.cs
generated
Normal file
1477
Data/Migrations/Postgresql/20220102221801_RemoveUniqueAliasIndexConstraint.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Data.Migrations.Postgresql
|
||||||
|
{
|
||||||
|
public partial class RemoveUniqueAliasIndexConstraint : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias",
|
||||||
|
columns: new[] { "Name", "IPAddress" });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_EFAlias_Name_IPAddress",
|
||||||
|
table: "EFAlias",
|
||||||
|
columns: new[] { "Name", "IPAddress" },
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -836,8 +836,7 @@ namespace Data.Migrations.Postgresql
|
|||||||
|
|
||||||
b.HasIndex("SearchableName");
|
b.HasIndex("SearchableName");
|
||||||
|
|
||||||
b.HasIndex("Name", "IPAddress")
|
b.HasIndex("Name", "IPAddress");
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("EFAlias");
|
b.ToTable("EFAlias");
|
||||||
});
|
});
|
||||||
|
1448
Data/Migrations/Sqlite/20220102214442_RemoveUniqueAliasIndexConstraint.Designer.cs
generated
Normal file
1448
Data/Migrations/Sqlite/20220102214442_RemoveUniqueAliasIndexConstraint.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Data.Migrations.Sqlite
|
||||||
|
{
|
||||||
|
public partial class RemoveUniqueAliasIndexConstraint : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -815,8 +815,7 @@ namespace Data.Migrations.Sqlite
|
|||||||
|
|
||||||
b.HasIndex("SearchableName");
|
b.HasIndex("SearchableName");
|
||||||
|
|
||||||
b.HasIndex("Name", "IPAddress")
|
b.HasIndex("Name", "IPAddress");
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("EFAlias");
|
b.ToTable("EFAlias");
|
||||||
});
|
});
|
||||||
|
@ -153,7 +153,7 @@ namespace SharedLibraryCore.Services
|
|||||||
{
|
{
|
||||||
_logger.LogDebug("[{Method}] creating new Link and Alias for {Entity}", nameof(HandleNewCreate), entity.ToString());
|
_logger.LogDebug("[{Method}] creating new Link and Alias for {Entity}", nameof(HandleNewCreate), entity.ToString());
|
||||||
var link = new EFAliasLink();
|
var link = new EFAliasLink();
|
||||||
var alias = new EFAlias()
|
var alias = new EFAlias
|
||||||
{
|
{
|
||||||
Name = entity.Name,
|
Name = entity.Name,
|
||||||
SearchableName = entity.Name.StripColors().ToLower(),
|
SearchableName = entity.Name.StripColors().ToLower(),
|
||||||
@ -167,9 +167,18 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogDebug("[{Method}] associating new GUID {Guid} with existing alias id {aliasId} for {Entity}",
|
_logger.LogDebug("[{Method}] associating new GUID {Guid} with new exact alias match with linkId {LinkId} for {Entity}",
|
||||||
nameof(HandleNewCreate), entity.GuidString, existingAlias.AliasId, entity.ToString());
|
nameof(HandleNewCreate), entity.GuidString, existingAlias.LinkId, entity.ToString());
|
||||||
client.CurrentAliasId = existingAlias.AliasId;
|
|
||||||
|
var alias = new EFAlias
|
||||||
|
{
|
||||||
|
Name = existingAlias.Name,
|
||||||
|
SearchableName = entity.Name.StripColors().ToLower(),
|
||||||
|
DateAdded = DateTime.UtcNow,
|
||||||
|
IPAddress = entity.IPAddress,
|
||||||
|
LinkId = existingAlias.LinkId
|
||||||
|
};
|
||||||
|
client.CurrentAlias = alias;
|
||||||
client.AliasLinkId = existingAlias.LinkId;
|
client.AliasLinkId = existingAlias.LinkId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +347,7 @@ namespace SharedLibraryCore.Services
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existingExactAlias != null)
|
if (existingExactAlias != null && entity.AliasLinkId == existingExactAlias.LinkId)
|
||||||
{
|
{
|
||||||
entity.CurrentAlias = existingExactAlias;
|
entity.CurrentAlias = existingExactAlias;
|
||||||
entity.CurrentAliasId = existingExactAlias.AliasId;
|
entity.CurrentAliasId = existingExactAlias.AliasId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user