diff options
Diffstat (limited to 'Jellyfin.Server.Implementations/JellyfinDb.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/JellyfinDb.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs index 45e71f16e..7f3f83749 100644 --- a/Jellyfin.Server.Implementations/JellyfinDb.cs +++ b/Jellyfin.Server.Implementations/JellyfinDb.cs @@ -1,5 +1,6 @@ #pragma warning disable CS1591 +using System; using System.Linq; using Jellyfin.Data.Entities; using Jellyfin.Data.Interfaces; @@ -33,6 +34,8 @@ namespace Jellyfin.Server.Implementations public virtual DbSet<ItemDisplayPreferences> ItemDisplayPreferences { get; set; } + public virtual DbSet<CustomItemDisplayPreferences> CustomItemDisplayPreferences { get; set; } + public virtual DbSet<Permission> Permissions { get; set; } public virtual DbSet<Preference> Preferences { get; set; } @@ -140,6 +143,7 @@ namespace Jellyfin.Server.Implementations /// <inheritdoc /> protected override void OnModelCreating(ModelBuilder modelBuilder) { + modelBuilder.SetDefaultDateTimeKind(DateTimeKind.Utc); base.OnModelCreating(modelBuilder); modelBuilder.HasDefaultSchema("jellyfin"); @@ -149,7 +153,15 @@ namespace Jellyfin.Server.Implementations .IsUnique(false); modelBuilder.Entity<DisplayPreferences>() - .HasIndex(entity => new { entity.UserId, entity.Client }) + .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client }) + .IsUnique(); + + modelBuilder.Entity<CustomItemDisplayPreferences>() + .HasIndex(entity => entity.UserId) + .IsUnique(false); + + modelBuilder.Entity<CustomItemDisplayPreferences>() + .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client, entity.Key }) .IsUnique(); } } |
