Merge pull request #18276 from Shadowghost/fix/18272-extras-ownerid-index

Make the OwnerId and ExtraType/OwnerId indexes partial so extras lookups keep using them
This commit is contained in:
Cody Robibero authored and GitHub committed 2026-10-04 16:59:02 -06:00
commit 7cf12e5fb9
4 files changed
+1869 -2

No files matched your search

@@ -35,9 +35,11 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>
builder.HasIndex(e => e.Path);
builder.HasIndex(e => e.ParentId);
builder.HasIndex(e => e.OwnerId);
builder.HasIndex(e => e.OwnerId)
.HasFilter("\"OwnerId\" IS NOT NULL");
builder.HasIndex(e => e.Name);
builder.HasIndex(e => new { e.ExtraType, e.OwnerId });
builder.HasIndex(e => new { e.ExtraType, e.OwnerId })
.HasFilter("\"ExtraType\" IS NOT NULL");
builder.HasIndex(e => e.PresentationUniqueKey);
// covering index
builder.HasIndex(e => new { e.TopParentId, e.Id });
@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jellyfin.Database.Providers.Sqlite.Migrations
{
/// <inheritdoc />
public partial class MakeOwnerIdIndexesPartial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_BaseItems_ExtraType_OwnerId",
table: "BaseItems");
migrationBuilder.DropIndex(
name: "IX_BaseItems_OwnerId",
table: "BaseItems");
migrationBuilder.CreateIndex(
name: "IX_BaseItems_ExtraType_OwnerId",
table: "BaseItems",
columns: new[] { "ExtraType", "OwnerId" },
filter: "\"ExtraType\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_BaseItems_OwnerId",
table: "BaseItems",
column: "OwnerId",
filter: "\"OwnerId\" IS NOT NULL");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_BaseItems_ExtraType_OwnerId",
table: "BaseItems");
migrationBuilder.DropIndex(
name: "IX_BaseItems_OwnerId",
table: "BaseItems");
migrationBuilder.CreateIndex(
name: "IX_BaseItems_ExtraType_OwnerId",
table: "BaseItems",
columns: new[] { "ExtraType", "OwnerId" });
migrationBuilder.CreateIndex(
name: "IX_BaseItems_OwnerId",
table: "BaseItems",
column: "OwnerId");
}
}
}