DeviceConfiguration.cs 875 B

12345678910111213141516171819202122232425262728
  1. using Jellyfin.Data.Entities.Security;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Jellyfin.Server.Implementations.ModelConfiguration
  5. {
  6. /// <summary>
  7. /// FluentAPI configuration for the Device entity.
  8. /// </summary>
  9. public class DeviceConfiguration : IEntityTypeConfiguration<Device>
  10. {
  11. /// <inheritdoc/>
  12. public void Configure(EntityTypeBuilder<Device> builder)
  13. {
  14. builder
  15. .HasIndex(entity => new { entity.DeviceId, entity.DateLastActivity });
  16. builder
  17. .HasIndex(entity => new { entity.AccessToken, entity.DateLastActivity });
  18. builder
  19. .HasIndex(entity => new { entity.UserId, entity.DeviceId });
  20. builder
  21. .HasIndex(entity => entity.DeviceId);
  22. }
  23. }
  24. }