i have too much time.

Refactored BaseItem and UserData relation
This commit is contained in:
JPVenson
2024-10-20 10:11:24 +00:00
parent cd2e043472
commit 10a2a316a4
8 changed files with 88 additions and 62 deletions

View File

@@ -35,7 +35,6 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>
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 });

View File

@@ -13,10 +13,11 @@ public class UserDataConfiguration : IEntityTypeConfiguration<UserData>
/// <inheritdoc/>
public void Configure(EntityTypeBuilder<UserData> builder)
{
builder.HasKey(d => new { d.Key, d.UserId });
builder.HasIndex(d => new { d.Key, d.UserId, d.Played });
builder.HasIndex(d => new { d.Key, d.UserId, d.PlaybackPositionTicks });
builder.HasIndex(d => new { d.Key, d.UserId, d.IsFavorite });
builder.HasIndex(d => new { d.Key, d.UserId, d.LastPlayedDate });
builder.HasKey(d => new { d.ItemId, d.UserId });
builder.HasIndex(d => new { d.ItemId, d.UserId, d.Played });
builder.HasIndex(d => new { d.ItemId, d.UserId, d.PlaybackPositionTicks });
builder.HasIndex(d => new { d.ItemId, d.UserId, d.IsFavorite });
builder.HasIndex(d => new { d.ItemId, d.UserId, d.LastPlayedDate });
builder.HasOne(e => e.Item);
}
}