Add index for server snapshot captured at

This commit is contained in:
RaidMax 2023-07-05 08:33:20 -05:00
parent 4740479ace
commit 41efe26a48
10 changed files with 5099 additions and 1 deletions

View File

@ -153,6 +153,8 @@ namespace Data.Context
modelBuilder.Entity<EFClientConnectionHistory>(ent => ent.HasIndex(history => history.CreatedDateTime)); modelBuilder.Entity<EFClientConnectionHistory>(ent => ent.HasIndex(history => history.CreatedDateTime));
modelBuilder.Entity<EFServerSnapshot>(ent => ent.HasIndex(snapshot => snapshot.CapturedAt));
// force full name for database conversion // force full name for database conversion
modelBuilder.Entity<EFClient>().ToTable("EFClients"); modelBuilder.Entity<EFClient>().ToTable("EFClients");
modelBuilder.Entity<EFAlias>().ToTable("EFAlias"); modelBuilder.Entity<EFAlias>().ToTable("EFAlias");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.MySql
{
public partial class AddIndexToEFServerSnapshotCapturedAt : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_EFServerSnapshot_CapturedAt",
table: "EFServerSnapshot",
column: "CapturedAt");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EFServerSnapshot_CapturedAt",
table: "EFServerSnapshot");
}
}
}

View File

@ -814,6 +814,7 @@ namespace Data.Migrations.MySql
b.Property<string>("SearchableIPAddress") b.Property<string>("SearchableIPAddress")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasMaxLength(255)
.HasColumnType("varchar(255)") .HasColumnType("varchar(255)")
.HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true); .HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true);
@ -1110,6 +1111,8 @@ namespace Data.Migrations.MySql
b.HasKey("ServerSnapshotId"); b.HasKey("ServerSnapshotId");
b.HasIndex("CapturedAt");
b.HasIndex("MapId"); b.HasIndex("MapId");
b.HasIndex("ServerId"); b.HasIndex("ServerId");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Postgresql
{
public partial class AddIndexToEFServerSnapshotCapturedAt : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SearchableIPAddress",
table: "EFAlias",
type: "character varying(255)",
maxLength: 255,
nullable: true,
computedColumnSql: "((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)",
stored: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true,
oldComputedColumnSql: "((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)",
oldStored: true);
migrationBuilder.CreateIndex(
name: "IX_EFServerSnapshot_CapturedAt",
table: "EFServerSnapshot",
column: "CapturedAt");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EFServerSnapshot_CapturedAt",
table: "EFServerSnapshot");
migrationBuilder.AlterColumn<string>(
name: "SearchableIPAddress",
table: "EFAlias",
type: "text",
nullable: true,
computedColumnSql: "((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)",
stored: true,
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true,
oldComputedColumnSql: "((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)",
oldStored: true);
}
}
}

View File

@ -853,7 +853,8 @@ namespace Data.Migrations.Postgresql
b.Property<string>("SearchableIPAddress") b.Property<string>("SearchableIPAddress")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("text") .HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true); .HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true);
b.Property<string>("SearchableName") b.Property<string>("SearchableName")
@ -1163,6 +1164,8 @@ namespace Data.Migrations.Postgresql
b.HasKey("ServerSnapshotId"); b.HasKey("ServerSnapshotId");
b.HasIndex("CapturedAt");
b.HasIndex("MapId"); b.HasIndex("MapId");
b.HasIndex("ServerId"); b.HasIndex("ServerId");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Sqlite
{
public partial class AddIndexToEFServerSnapshotCapturedAt : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_EFServerSnapshot_CapturedAt",
table: "EFServerSnapshot",
column: "CapturedAt");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EFServerSnapshot_CapturedAt",
table: "EFServerSnapshot");
}
}
}

View File

@ -812,6 +812,7 @@ namespace Data.Migrations.Sqlite
b.Property<string>("SearchableIPAddress") b.Property<string>("SearchableIPAddress")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasMaxLength(255)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true); .HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true);
@ -1108,6 +1109,8 @@ namespace Data.Migrations.Sqlite
b.HasKey("ServerSnapshotId"); b.HasKey("ServerSnapshotId");
b.HasIndex("CapturedAt");
b.HasIndex("MapId"); b.HasIndex("MapId");
b.HasIndex("ServerId"); b.HasIndex("ServerId");