aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2020-09-05 17:54:34 -0400
committerPatrick Barron <barronpm@gmail.com>2020-09-05 17:54:34 -0400
commitdb46a9e7c883c2008055a7c75905c0efe42d5677 (patch)
tree4925d024b8f7c6410df824c6c5f1509864b74fd5
parent9cffa66a015c5200e461f396cd408949591d9552 (diff)
Clean up JellyfinDb and fix display preferences index.
-rw-r--r--Jellyfin.Server.Implementations/JellyfinDb.cs40
1 files changed, 4 insertions, 36 deletions
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs
index 08e4db388..92636daa3 100644
--- a/Jellyfin.Server.Implementations/JellyfinDb.cs
+++ b/Jellyfin.Server.Implementations/JellyfinDb.cs
@@ -1,6 +1,5 @@
#pragma warning disable CS1591
-using System;
using System.Linq;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Interfaces;
@@ -9,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Jellyfin.Server.Implementations
{
/// <inheritdoc/>
- public partial class JellyfinDb : DbContext
+ public class JellyfinDb : DbContext
{
/// <summary>
/// Initializes a new instance of the <see cref="JellyfinDb"/> class.
@@ -138,47 +137,16 @@ namespace Jellyfin.Server.Implementations
return base.SaveChanges();
}
- /// <inheritdoc/>
- public override void Dispose()
- {
- foreach (var entry in ChangeTracker.Entries())
- {
- entry.State = EntityState.Detached;
- }
-
- GC.SuppressFinalize(this);
- base.Dispose();
- }
-
- /// <inheritdoc />
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- CustomInit(optionsBuilder);
- }
-
/// <inheritdoc />
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
- OnModelCreatingImpl(modelBuilder);
modelBuilder.HasDefaultSchema("jellyfin");
- /*modelBuilder.Entity<Artwork>().HasIndex(t => t.Kind);
-
- modelBuilder.Entity<Genre>().HasIndex(t => t.Name)
- .IsUnique();
-
- modelBuilder.Entity<LibraryItem>().HasIndex(t => t.UrlId)
- .IsUnique();*/
-
- OnModelCreatedImpl(modelBuilder);
+ modelBuilder.Entity<DisplayPreferences>()
+ .HasIndex(entity => new { entity.UserId, entity.Client })
+ .IsUnique();
}
-
- partial void CustomInit(DbContextOptionsBuilder optionsBuilder);
-
- partial void OnModelCreatingImpl(ModelBuilder modelBuilder);
-
- partial void OnModelCreatedImpl(ModelBuilder modelBuilder);
}
}