Add time index to connection log (#29281)

* Add time index to connection log

Queries go nyoom.

* Don't let me code shit at 5 AM
This commit is contained in:
Pieter-Jan Briers
2024-06-21 15:29:10 +02:00
committed by GitHub
parent 730a4d289d
commit f041f58a6d
7 changed files with 3816 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Content.Server.Database.Migrations.Postgres
{
/// <inheritdoc />
public partial class ConnectionLogTimeIndex : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_connection_log_time",
table: "connection_log",
column: "time");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_connection_log_time",
table: "connection_log");
}
}
}

View File

@@ -559,6 +559,8 @@ namespace Content.Server.Database.Migrations.Postgres
b.HasIndex("ServerId")
.HasDatabaseName("IX_connection_log_server_id");
b.HasIndex("Time");
b.HasIndex("UserId");
b.ToTable("connection_log", null, t =>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Content.Server.Database.Migrations.Sqlite
{
/// <inheritdoc />
public partial class ConnectionLogTimeIndex : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_connection_log_time",
table: "connection_log",
column: "time");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_connection_log_time",
table: "connection_log");
}
}
}

View File

@@ -528,6 +528,8 @@ namespace Content.Server.Database.Migrations.Sqlite
b.HasIndex("ServerId")
.HasDatabaseName("IX_connection_log_server_id");
b.HasIndex("Time");
b.HasIndex("UserId");
b.ToTable("connection_log", (string)null);

View File

@@ -187,6 +187,9 @@ namespace Content.Server.Database
modelBuilder.Entity<ConnectionLog>()
.HasIndex(p => p.UserId);
modelBuilder.Entity<ConnectionLog>()
.HasIndex(p => p.Time);
modelBuilder.Entity<ConnectionLog>()
.Property(p => p.ServerId)
.HasDefaultValue(0);