DeviceConfiguration.cs 899 B

123456789101112131415161718192021222324252627282930
  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. // Indexes
  15. builder
  16. .HasIndex(entity => new { entity.DeviceId, entity.DateLastActivity });
  17. builder
  18. .HasIndex(entity => new { entity.AccessToken, entity.DateLastActivity });
  19. builder
  20. .HasIndex(entity => new { entity.UserId, entity.DeviceId });
  21. builder
  22. .HasIndex(entity => entity.DeviceId);
  23. }
  24. }
  25. }