Fix admin log indices. (#7920)
This commit is contained in:
committed by
GitHub
parent
faec39da2b
commit
fc119befca
1252
Content.Server.Database/Migrations/Postgres/20220503222955_FixIndices.Designer.cs
generated
Normal file
1252
Content.Server.Database/Migrations/Postgres/20220503222955_FixIndices.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Postgres
|
||||
{
|
||||
public partial class FixIndices : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_admin_log_message",
|
||||
table: "admin_log");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_admin_log_date",
|
||||
table: "admin_log",
|
||||
column: "date");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_admin_log_message",
|
||||
table: "admin_log",
|
||||
column: "message")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN")
|
||||
.Annotation("Npgsql:TsVectorConfig", "english");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_admin_log_date",
|
||||
table: "admin_log");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_admin_log_message",
|
||||
table: "admin_log");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_admin_log_message",
|
||||
table: "admin_log",
|
||||
column: "message")
|
||||
.Annotation("Npgsql:TsVectorConfig", "english");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,9 +120,13 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
b.HasKey("Id", "RoundId")
|
||||
.HasName("PK_admin_log");
|
||||
|
||||
b.HasIndex("Date");
|
||||
|
||||
b.HasIndex("Message")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Message"), "GIN");
|
||||
|
||||
b.HasIndex("RoundId")
|
||||
.HasDatabaseName("IX_admin_log_round_id");
|
||||
|
||||
|
||||
1190
Content.Server.Database/Migrations/Sqlite/20220503222949_FixIndices.Designer.cs
generated
Normal file
1190
Content.Server.Database/Migrations/Sqlite/20220503222949_FixIndices.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Sqlite
|
||||
{
|
||||
public partial class FixIndices : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_admin_log_date",
|
||||
table: "admin_log",
|
||||
column: "date");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_admin_log_date",
|
||||
table: "admin_log");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,8 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
b.HasKey("Id", "RoundId")
|
||||
.HasName("PK_admin_log");
|
||||
|
||||
b.HasIndex("Date");
|
||||
|
||||
b.HasIndex("RoundId")
|
||||
.HasDatabaseName("IX_admin_log_round_id");
|
||||
|
||||
|
||||
@@ -91,6 +91,9 @@ namespace Content.Server.Database
|
||||
.Property(log => log.Id)
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
modelBuilder.Entity<AdminLog>()
|
||||
.HasIndex(log => log.Date);
|
||||
|
||||
modelBuilder.Entity<AdminLogPlayer>()
|
||||
.HasOne(player => player.Player)
|
||||
.WithMany(player => player.AdminLogs)
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Content.Server.Database
|
||||
|
||||
modelBuilder.Entity<AdminLog>()
|
||||
.HasIndex(l => l.Message)
|
||||
.HasMethod("GIN")
|
||||
.IsTsVectorExpressionIndex("english");
|
||||
|
||||
foreach(var entity in modelBuilder.Model.GetEntityTypes())
|
||||
|
||||
Reference in New Issue
Block a user