[backend/database] Add indicies to the instance table

This commit is contained in:
Laura Hausmann 2024-04-25 00:40:51 +02:00
parent e2a528c8a6
commit eba6152493
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
4 changed files with 46 additions and 0 deletions

View file

@ -1527,8 +1527,12 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
b.HasIndex("Host") b.HasIndex("Host")
.IsUnique(); .IsUnique();
b.HasIndex("IncomingFollows");
b.HasIndex("IsSuspended"); b.HasIndex("IsSuspended");
b.HasIndex("OutgoingFollows");
b.ToTable("instance"); b.ToTable("instance");
}); });

View file

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Infrastructure;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
/// <inheritdoc />
[DbContext(typeof(DatabaseContext))]
[Migration("20240424224008_AddInstanceTableIndicies")]
public partial class AddInstanceTableIndicies : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_instance_incomingFollows",
table: "instance",
column: "incomingFollows");
migrationBuilder.CreateIndex(
name: "IX_instance_outgoingFollows",
table: "instance",
column: "outgoingFollows");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_instance_incomingFollows",
table: "instance");
migrationBuilder.DropIndex(
name: "IX_instance_outgoingFollows",
table: "instance");
}
}
}

View file

@ -9,6 +9,8 @@ namespace Iceshrimp.Backend.Core.Database.Tables;
[Index(nameof(CaughtAt))] [Index(nameof(CaughtAt))]
[Index(nameof(IsSuspended))] [Index(nameof(IsSuspended))]
[Index(nameof(Host), IsUnique = true)] [Index(nameof(Host), IsUnique = true)]
[Index(nameof(IncomingFollows))]
[Index(nameof(OutgoingFollows))]
public class Instance public class Instance
{ {
[Key] [Key]

View file

@ -13,6 +13,7 @@ namespace Iceshrimp.Backend.Core.Database.Tables;
[Index(nameof(CreatedAt))] [Index(nameof(CreatedAt))]
[Index(nameof(AppAccessTokenId))] [Index(nameof(AppAccessTokenId))]
[Index(nameof(MastoId))] [Index(nameof(MastoId))]
[Index(nameof(NoteId))]
public class Notification : IEntity public class Notification : IEntity
{ {
[PgName("notification_type_enum")] [PgName("notification_type_enum")]