aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs
blob: 1113adb7bc538d260b1117d1afea9c4b8b9397fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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.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 });
    }
}