Files
jellyfin-jellyfin-1/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/UserDataConfiguration.cs

23 lines
903 B
C#
Raw Normal View History

2025-03-25 16:45:00 +01:00
using Jellyfin.Database.Implementations.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
2025-03-25 15:30:22 +00:00
namespace Jellyfin.Database.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 });
2025-06-10 02:14:27 +03:00
builder.HasOne(e => e.Item).WithMany(e => e.UserData);
}
}