aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/ModelConfiguration
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration')
-rw-r--r--Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs23
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..8e6484437
--- /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.HasNoKey();
+ builder.HasIndex(d => new { d.Key, d.UserId }).IsUnique();
+ 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 });
+ }
+}