aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs
diff options
context:
space:
mode:
authorJPVenson <JPVenson@users.noreply.github.com>2024-09-08 16:56:14 +0000
committerGitHub <noreply@github.com>2024-09-08 16:56:14 +0000
commitee1bdf4e222125ed7382165fd7e09599ca4bd4aa (patch)
tree78b1e180c2626ccfc483f8bff9ec861079a6d8e6 /Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs
parentd0b4b2ddb31a54f0705303ab8461be1125d66eab (diff)
WIP move baseitem to jellyfin.db
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs')
-rw-r--r--Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs
new file mode 100644
index 000000000..c0f09670d
--- /dev/null
+++ b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs
@@ -0,0 +1,42 @@
+using System;
+using Jellyfin.Data.Entities;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace Jellyfin.Server.Implementations.ModelConfiguration;
+
+/// <summary>
+/// Configuration for BaseItem.
+/// </summary>
+public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItem>
+{
+ /// <inheritdoc/>
+ public void Configure(EntityTypeBuilder<BaseItem> builder)
+ {
+ builder.HasNoKey();
+ builder.HasIndex(e => e.Path);
+ builder.HasIndex(e => e.ParentId);
+ builder.HasIndex(e => e.PresentationUniqueKey);
+ builder.HasIndex(e => new { e.Id, e.Type, e.IsFolder, e.IsVirtualItem });
+ builder.HasIndex(e => new { e.UserDataKey, e.Type });
+
+ // covering index
+ builder.HasIndex(e => new { e.TopParentId, e.Id });
+ // series
+ builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.PresentationUniqueKey, e.SortName });
+ // series counts
+ // seriesdateplayed sort order
+ builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.IsFolder, e.IsVirtualItem });
+ // live tv programs
+ builder.HasIndex(e => new { e.Type, e.TopParentId, e.StartDate });
+ // covering index for getitemvalues
+ builder.HasIndex(e => new { e.Type, e.TopParentId, e.Id });
+ // used by movie suggestions
+ builder.HasIndex(e => new { e.Type, e.TopParentId, e.PresentationUniqueKey });
+ // latest items
+ builder.HasIndex(e => new { e.Type, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated });
+ builder.HasIndex(e => new { e.IsFolder, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated });
+ // resume
+ builder.HasIndex(e => new { e.MediaType, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey });
+ }
+}