diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2025-01-25 02:08:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-25 02:08:44 -0500 |
| commit | 93b8eade617dbce16979bbada63b7faf44c5ce82 (patch) | |
| tree | 5ef83a80b4ef1f713961d32ee6311c6033a3a9a9 /Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs | |
| parent | 679ee960d346f24d7df559cbbaf95cf1c9567345 (diff) | |
| parent | 64cf67f1ac758acd36db61432c97e434d9f9225d (diff) | |
Merge pull request #12798 from JPVenson/feature/EFUserData
Refactor library.db into jellyfin.db and EFCore
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs new file mode 100644 index 000000000..7bbb28d43 --- /dev/null +++ b/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs @@ -0,0 +1,23 @@ +using System; +using Jellyfin.Data.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace Jellyfin.Server.Implementations.ModelConfiguration; + +/// <summary> +/// FluentAPI configuration for the UserData entity. +/// </summary> +public class UserDataConfiguration : IEntityTypeConfiguration<UserData> +{ + /// <inheritdoc/> + public void Configure(EntityTypeBuilder<UserData> builder) + { + builder.HasKey(d => new { d.ItemId, d.UserId, d.CustomDataKey }); + 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); + } +} |
