diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2025-08-03 17:27:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-03 17:27:17 -0400 |
| commit | 4b6fb6c4bb2478badad068ce18aabe0c2955db48 (patch) | |
| tree | 15f986ee62327cceb8f5c8f009bcf08d10cfaa66 /Jellyfin.Server.Implementations | |
| parent | e7bc86ebb8496615e0b3f73eb4f13ab4c0913dc8 (diff) | |
| parent | db7465e83d9cc07134a0bffad7ed17b1c7b873da (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'Jellyfin.Server.Implementations')
122 files changed, 1881 insertions, 28502 deletions
diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs index 54272aeaf..8d492f7cd 100644 --- a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs +++ b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs @@ -1,9 +1,10 @@ using System; using System.Linq; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Events; using Jellyfin.Data.Queries; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Querying; using Microsoft.EntityFrameworkCore; diff --git a/Jellyfin.Server.Implementations/DbConfiguration/DatabaseConfigurationFactory.cs b/Jellyfin.Server.Implementations/DbConfiguration/DatabaseConfigurationFactory.cs new file mode 100644 index 000000000..26d32f417 --- /dev/null +++ b/Jellyfin.Server.Implementations/DbConfiguration/DatabaseConfigurationFactory.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using MediaBrowser.Common.Configuration; + +namespace Jellyfin.Server.Implementations.DatabaseConfiguration; + +/// <summary> +/// Factory for constructing a database configuration. +/// </summary> +public class DatabaseConfigurationFactory : IConfigurationFactory +{ + /// <inheritdoc/> + public IEnumerable<ConfigurationStore> GetConfigurations() + { + yield return new DatabaseConfigurationStore(); + } +} diff --git a/Jellyfin.Server.Implementations/DbConfiguration/DatabaseConfigurationStore.cs b/Jellyfin.Server.Implementations/DbConfiguration/DatabaseConfigurationStore.cs new file mode 100644 index 000000000..537630561 --- /dev/null +++ b/Jellyfin.Server.Implementations/DbConfiguration/DatabaseConfigurationStore.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using Jellyfin.Database.Implementations.DbConfiguration; +using MediaBrowser.Common.Configuration; + +namespace Jellyfin.Server.Implementations.DatabaseConfiguration; + +/// <summary> +/// A configuration that stores database related settings. +/// </summary> +public class DatabaseConfigurationStore : ConfigurationStore +{ + /// <summary> + /// The name of the configuration in the storage. + /// </summary> + public const string StoreKey = "database"; + + /// <summary> + /// Initializes a new instance of the <see cref="DatabaseConfigurationStore"/> class. + /// </summary> + public DatabaseConfigurationStore() + { + ConfigurationType = typeof(DatabaseConfigurationOptions); + Key = StoreKey; + } +} diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs index d3bff2936..51a118645 100644 --- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs +++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs @@ -3,12 +3,14 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Jellyfin.Data; using Jellyfin.Data.Dtos; -using Jellyfin.Data.Entities; -using Jellyfin.Data.Entities.Security; -using Jellyfin.Data.Enums; using Jellyfin.Data.Events; using Jellyfin.Data.Queries; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; +using Jellyfin.Database.Implementations.Entities.Security; +using Jellyfin.Database.Implementations.Enums; using Jellyfin.Extensions; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Devices; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Library/LyricDownloadFailureLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Library/LyricDownloadFailureLogger.cs index 0d52bb985..5f4864e95 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Library/LyricDownloadFailureLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Library/LyricDownloadFailureLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Events; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Library/SubtitleDownloadFailureLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Library/SubtitleDownloadFailureLogger.cs index 0a8c064a9..8fe380e4f 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Library/SubtitleDownloadFailureLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Library/SubtitleDownloadFailureLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Events; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs index a4424c739..1a8931a6d 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Authentication; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs index e0ecef2a5..584d559e4 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs @@ -1,6 +1,6 @@ using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Authentication; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs index 0ef929a99..73323acb3 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs @@ -1,8 +1,8 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Enums; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs index 7d452ea2f..b75567539 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs @@ -1,8 +1,8 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Enums; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionEndedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionEndedLogger.cs index 77e7859c6..b90708a2f 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionEndedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionEndedLogger.cs @@ -1,6 +1,6 @@ using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Session; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionStartedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionStartedLogger.cs index 141dc20ea..139c2e2ac 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionStartedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/SessionStartedLogger.cs @@ -1,6 +1,6 @@ using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Session; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/System/TaskCompletedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/System/TaskCompletedLogger.cs index b0a9393eb..da82a3b30 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/System/TaskCompletedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/System/TaskCompletedLogger.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Text; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Globalization; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedLogger.cs index 0ae9b7f66..632f30c7a 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Common.Updates; using MediaBrowser.Controller.Events; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstalledLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstalledLogger.cs index 287ba578b..4b49b714c 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstalledLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstalledLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Updates; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUninstalledLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUninstalledLogger.cs index 2de207b15..2d24de7fc 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUninstalledLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUninstalledLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Updates; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUpdatedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUpdatedLogger.cs index 08d6bf9c2..e892d3dd9 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUpdatedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginUpdatedLogger.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Controller.Events.Updates; using MediaBrowser.Model.Activity; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserCreatedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserCreatedLogger.cs index a09c344f6..4f063f6a1 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserCreatedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserCreatedLogger.cs @@ -1,7 +1,7 @@ using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Events.Users; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Globalization; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserDeletedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserDeletedLogger.cs index 46da8044a..ba4a072e8 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserDeletedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserDeletedLogger.cs @@ -1,8 +1,8 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Events.Users; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Globalization; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserLockedOutLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserLockedOutLogger.cs index 1d0d016a7..bbc00567d 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserLockedOutLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserLockedOutLogger.cs @@ -1,7 +1,7 @@ using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Events.Users; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Globalization; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserPasswordChangedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserPasswordChangedLogger.cs index 2b8f966a8..7219704ec 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Users/UserPasswordChangedLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Users/UserPasswordChangedLogger.cs @@ -1,7 +1,7 @@ using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; using Jellyfin.Data.Events.Users; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Events; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Globalization; diff --git a/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs b/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs new file mode 100644 index 000000000..d70ac672f --- /dev/null +++ b/Jellyfin.Server.Implementations/Extensions/ExpressionExtensions.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; + +namespace Jellyfin.Server.Implementations.Extensions; + +/// <summary> +/// Provides <see cref="Expression"/> extension methods. +/// </summary> +public static class ExpressionExtensions +{ + /// <summary> + /// Combines two predicates into a single predicate using a logical OR operation. + /// </summary> + /// <typeparam name="T">The predicate parameter type.</typeparam> + /// <param name="firstPredicate">The first predicate expression to combine.</param> + /// <param name="secondPredicate">The second predicate expression to combine.</param> + /// <returns>A new expression representing the OR combination of the input predicates.</returns> + public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> firstPredicate, Expression<Func<T, bool>> secondPredicate) + { + ArgumentNullException.ThrowIfNull(firstPredicate); + ArgumentNullException.ThrowIfNull(secondPredicate); + + var invokedExpression = Expression.Invoke(secondPredicate, firstPredicate.Parameters); + return Expression.Lambda<Func<T, bool>>(Expression.OrElse(firstPredicate.Body, invokedExpression), firstPredicate.Parameters); + } + + /// <summary> + /// Combines multiple predicates into a single predicate using a logical OR operation. + /// </summary> + /// <typeparam name="T">The predicate parameter type.</typeparam> + /// <param name="predicates">A collection of predicate expressions to combine.</param> + /// <returns>A new expression representing the OR combination of all input predicates.</returns> + public static Expression<Func<T, bool>> Or<T>(this IEnumerable<Expression<Func<T, bool>>> predicates) + { + ArgumentNullException.ThrowIfNull(predicates); + + return predicates.Aggregate((aggregatePredicate, nextPredicate) => aggregatePredicate.Or(nextPredicate)); + } + + /// <summary> + /// Combines two predicates into a single predicate using a logical AND operation. + /// </summary> + /// <typeparam name="T">The predicate parameter type.</typeparam> + /// <param name="firstPredicate">The first predicate expression to combine.</param> + /// <param name="secondPredicate">The second predicate expression to combine.</param> + /// <returns>A new expression representing the AND combination of the input predicates.</returns> + public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> firstPredicate, Expression<Func<T, bool>> secondPredicate) + { + ArgumentNullException.ThrowIfNull(firstPredicate); + ArgumentNullException.ThrowIfNull(secondPredicate); + + var invokedExpression = Expression.Invoke(secondPredicate, firstPredicate.Parameters); + return Expression.Lambda<Func<T, bool>>(Expression.AndAlso(firstPredicate.Body, invokedExpression), firstPredicate.Parameters); + } + + /// <summary> + /// Combines multiple predicates into a single predicate using a logical AND operation. + /// </summary> + /// <typeparam name="T">The predicate parameter type.</typeparam> + /// <param name="predicates">A collection of predicate expressions to combine.</param> + /// <returns>A new expression representing the AND combination of all input predicates.</returns> + public static Expression<Func<T, bool>> And<T>(this IEnumerable<Expression<Func<T, bool>>> predicates) + { + ArgumentNullException.ThrowIfNull(predicates); + + return predicates.Aggregate((aggregatePredicate, nextPredicate) => aggregatePredicate.And(nextPredicate)); + } +} diff --git a/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs b/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs index 7eee26059..932f9d625 100644 --- a/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs +++ b/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs @@ -1,8 +1,18 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Reflection; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.DbConfiguration; +using Jellyfin.Database.Implementations.Locking; +using Jellyfin.Database.Providers.Sqlite; using MediaBrowser.Common.Configuration; +using MediaBrowser.Controller.Configuration; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using JellyfinDbProviderFactory = System.Func<System.IServiceProvider, Jellyfin.Database.Implementations.IJellyfinDatabaseProvider>; namespace Jellyfin.Server.Implementations.Extensions; @@ -11,17 +21,127 @@ namespace Jellyfin.Server.Implementations.Extensions; /// </summary> public static class ServiceCollectionExtensions { + private static IEnumerable<Type> DatabaseProviderTypes() + { + yield return typeof(SqliteDatabaseProvider); + } + + private static IDictionary<string, JellyfinDbProviderFactory> GetSupportedDbProviders() + { + var items = new Dictionary<string, JellyfinDbProviderFactory>(StringComparer.InvariantCultureIgnoreCase); + foreach (var providerType in DatabaseProviderTypes()) + { + var keyAttribute = providerType.GetCustomAttribute<JellyfinDatabaseProviderKeyAttribute>(); + if (keyAttribute is null || string.IsNullOrWhiteSpace(keyAttribute.DatabaseProviderKey)) + { + continue; + } + + var provider = providerType; + items[keyAttribute.DatabaseProviderKey] = (services) => (IJellyfinDatabaseProvider)ActivatorUtilities.CreateInstance(services, providerType); + } + + return items; + } + + private static JellyfinDbProviderFactory? LoadDatabasePlugin(CustomDatabaseOptions customProviderOptions, IApplicationPaths applicationPaths) + { + var plugin = Directory.EnumerateDirectories(applicationPaths.PluginsPath) + .Where(e => Path.GetFileName(e)!.StartsWith(customProviderOptions.PluginName, StringComparison.OrdinalIgnoreCase)) + .Order() + .FirstOrDefault() + ?? throw new InvalidOperationException($"The requested custom database plugin with the name '{customProviderOptions.PluginName}' could not been found in '{applicationPaths.PluginsPath}'"); + + var dbProviderAssembly = Path.Combine(plugin, Path.ChangeExtension(customProviderOptions.PluginAssembly, "dll")); + if (!File.Exists(dbProviderAssembly)) + { + throw new InvalidOperationException($"Could not find the requested assembly at '{dbProviderAssembly}'"); + } + + // we have to load the assembly without proxy to ensure maximum performance for this. + var assembly = Assembly.LoadFrom(dbProviderAssembly); + var dbProviderType = assembly.GetExportedTypes().FirstOrDefault(f => f.IsAssignableTo(typeof(IJellyfinDatabaseProvider))) + ?? throw new InvalidOperationException($"Could not find any type implementing the '{nameof(IJellyfinDatabaseProvider)}' interface."); + + return (services) => (IJellyfinDatabaseProvider)ActivatorUtilities.CreateInstance(services, dbProviderType); + } + /// <summary> /// Adds the <see cref="IDbContextFactory{TContext}"/> interface to the service collection with second level caching enabled. /// </summary> /// <param name="serviceCollection">An instance of the <see cref="IServiceCollection"/> interface.</param> + /// <param name="configurationManager">The server configuration manager.</param> + /// <param name="configuration">The startup Configuration.</param> /// <returns>The updated service collection.</returns> - public static IServiceCollection AddJellyfinDbContext(this IServiceCollection serviceCollection) + public static IServiceCollection AddJellyfinDbContext( + this IServiceCollection serviceCollection, + IServerConfigurationManager configurationManager, + IConfiguration configuration) { + var efCoreConfiguration = configurationManager.GetConfiguration<DatabaseConfigurationOptions>("database"); + JellyfinDbProviderFactory? providerFactory = null; + + if (efCoreConfiguration?.DatabaseType is null) + { + var cmdMigrationArgument = configuration.GetValue<string>("migration-provider"); + if (!string.IsNullOrWhiteSpace(cmdMigrationArgument)) + { + efCoreConfiguration = new DatabaseConfigurationOptions() + { + DatabaseType = cmdMigrationArgument, + }; + } + else + { + // when nothing is setup via new Database configuration, fallback to SQLite with default settings. + efCoreConfiguration = new DatabaseConfigurationOptions() + { + DatabaseType = "Jellyfin-SQLite", + LockingBehavior = DatabaseLockingBehaviorTypes.NoLock + }; + configurationManager.SaveConfiguration("database", efCoreConfiguration); + } + } + + if (efCoreConfiguration.DatabaseType.Equals("PLUGIN_PROVIDER", StringComparison.OrdinalIgnoreCase)) + { + if (efCoreConfiguration.CustomProviderOptions is null) + { + throw new InvalidOperationException("The custom database provider must declare the custom provider options to work"); + } + + providerFactory = LoadDatabasePlugin(efCoreConfiguration.CustomProviderOptions, configurationManager.ApplicationPaths); + } + else + { + var providers = GetSupportedDbProviders(); + if (!providers.TryGetValue(efCoreConfiguration.DatabaseType.ToUpperInvariant(), out providerFactory!)) + { + throw new InvalidOperationException($"Jellyfin cannot find the database provider of type '{efCoreConfiguration.DatabaseType}'. Supported types are {string.Join(", ", providers.Keys)}"); + } + } + + serviceCollection.AddSingleton<IJellyfinDatabaseProvider>(providerFactory!); + + switch (efCoreConfiguration.LockingBehavior) + { + case DatabaseLockingBehaviorTypes.NoLock: + serviceCollection.AddSingleton<IEntityFrameworkCoreLockingBehavior, NoLockBehavior>(); + break; + case DatabaseLockingBehaviorTypes.Pessimistic: + serviceCollection.AddSingleton<IEntityFrameworkCoreLockingBehavior, PessimisticLockBehavior>(); + break; + case DatabaseLockingBehaviorTypes.Optimistic: + serviceCollection.AddSingleton<IEntityFrameworkCoreLockingBehavior, OptimisticLockBehavior>(); + break; + } + serviceCollection.AddPooledDbContextFactory<JellyfinDbContext>((serviceProvider, opt) => { - var applicationPaths = serviceProvider.GetRequiredService<IApplicationPaths>(); - opt.UseSqlite($"Filename={Path.Combine(applicationPaths.DataPath, "jellyfin.db")};Pooling=false"); + var provider = serviceProvider.GetRequiredService<IJellyfinDatabaseProvider>(); + provider.Initialise(opt, efCoreConfiguration); + var lockingBehavior = serviceProvider.GetRequiredService<IEntityFrameworkCoreLockingBehavior>(); + lockingBehavior.Initialise(opt); }); return serviceCollection; diff --git a/Jellyfin.Server.Implementations/FullSystemBackup/BackupManifest.cs b/Jellyfin.Server.Implementations/FullSystemBackup/BackupManifest.cs new file mode 100644 index 000000000..77a49b2b5 --- /dev/null +++ b/Jellyfin.Server.Implementations/FullSystemBackup/BackupManifest.cs @@ -0,0 +1,19 @@ +using System; + +namespace Jellyfin.Server.Implementations.FullSystemBackup; + +/// <summary> +/// Manifest type for backups internal structure. +/// </summary> +internal class BackupManifest +{ + public required Version ServerVersion { get; set; } + + public required Version BackupEngineVersion { get; set; } + + public required DateTimeOffset DateCreated { get; set; } + + public required string[] DatabaseTables { get; set; } + + public required BackupOptions Options { get; set; } +} diff --git a/Jellyfin.Server.Implementations/FullSystemBackup/BackupOptions.cs b/Jellyfin.Server.Implementations/FullSystemBackup/BackupOptions.cs new file mode 100644 index 000000000..8bd108c44 --- /dev/null +++ b/Jellyfin.Server.Implementations/FullSystemBackup/BackupOptions.cs @@ -0,0 +1,15 @@ +namespace Jellyfin.Server.Implementations.FullSystemBackup; + +/// <summary> +/// Defines the optional contents of the backup archive. +/// </summary> +internal class BackupOptions +{ + public bool Metadata { get; set; } + + public bool Trickplay { get; set; } + + public bool Subtitles { get; set; } + + public bool Database { get; set; } +} diff --git a/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs b/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs new file mode 100644 index 000000000..74d99455d --- /dev/null +++ b/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs @@ -0,0 +1,532 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Jellyfin.Database.Implementations; +using Jellyfin.Server.Implementations.StorageHelpers; +using Jellyfin.Server.Implementations.SystemBackupService; +using MediaBrowser.Controller; +using MediaBrowser.Controller.SystemBackupService; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace Jellyfin.Server.Implementations.FullSystemBackup; + +/// <summary> +/// Contains methods for creating and restoring backups. +/// </summary> +public class BackupService : IBackupService +{ + private const string ManifestEntryName = "manifest.json"; + private readonly ILogger<BackupService> _logger; + private readonly IDbContextFactory<JellyfinDbContext> _dbProvider; + private readonly IServerApplicationHost _applicationHost; + private readonly IServerApplicationPaths _applicationPaths; + private readonly IJellyfinDatabaseProvider _jellyfinDatabaseProvider; + private readonly IHostApplicationLifetime _hostApplicationLifetime; + private static readonly JsonSerializerOptions _serializerSettings = new JsonSerializerOptions(JsonSerializerDefaults.General) + { + AllowTrailingCommas = true, + ReferenceHandler = ReferenceHandler.IgnoreCycles, + }; + + private readonly Version _backupEngineVersion = Version.Parse("0.2.0"); + + /// <summary> + /// Initializes a new instance of the <see cref="BackupService"/> class. + /// </summary> + /// <param name="logger">A logger.</param> + /// <param name="dbProvider">A Database Factory.</param> + /// <param name="applicationHost">The Application host.</param> + /// <param name="applicationPaths">The application paths.</param> + /// <param name="jellyfinDatabaseProvider">The Jellyfin database Provider in use.</param> + /// <param name="applicationLifetime">The SystemManager.</param> + public BackupService( + ILogger<BackupService> logger, + IDbContextFactory<JellyfinDbContext> dbProvider, + IServerApplicationHost applicationHost, + IServerApplicationPaths applicationPaths, + IJellyfinDatabaseProvider jellyfinDatabaseProvider, + IHostApplicationLifetime applicationLifetime) + { + _logger = logger; + _dbProvider = dbProvider; + _applicationHost = applicationHost; + _applicationPaths = applicationPaths; + _jellyfinDatabaseProvider = jellyfinDatabaseProvider; + _hostApplicationLifetime = applicationLifetime; + } + + /// <inheritdoc/> + public void ScheduleRestoreAndRestartServer(string archivePath) + { + _applicationHost.RestoreBackupPath = archivePath; + _applicationHost.ShouldRestart = true; + _applicationHost.NotifyPendingRestart(); + _ = Task.Run(async () => + { + await Task.Delay(500).ConfigureAwait(false); + _hostApplicationLifetime.StopApplication(); + }); + } + + /// <inheritdoc/> + public async Task RestoreBackupAsync(string archivePath) + { + _logger.LogWarning("Begin restoring system to {BackupArchive}", archivePath); // Info isn't cutting it + if (!File.Exists(archivePath)) + { + throw new FileNotFoundException($"Requested backup file '{archivePath}' does not exist."); + } + + StorageHelper.TestCommonPathsForStorageCapacity(_applicationPaths, _logger); + + var fileStream = File.OpenRead(archivePath); + await using (fileStream.ConfigureAwait(false)) + { + using var zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Read, false); + var zipArchiveEntry = zipArchive.GetEntry(ManifestEntryName); + + if (zipArchiveEntry is null) + { + throw new NotSupportedException($"The loaded archive '{archivePath}' does not appear to be a Jellyfin backup as its missing the '{ManifestEntryName}'."); + } + + BackupManifest? manifest; + var manifestStream = zipArchiveEntry.Open(); + await using (manifestStream.ConfigureAwait(false)) + { + manifest = await JsonSerializer.DeserializeAsync<BackupManifest>(manifestStream, _serializerSettings).ConfigureAwait(false); + } + + if (manifest!.ServerVersion > _applicationHost.ApplicationVersion) // newer versions of Jellyfin should be able to load older versions as we have migrations. + { + throw new NotSupportedException($"The loaded archive '{archivePath}' is made for a newer version of Jellyfin ({manifest.ServerVersion}) and cannot be loaded in this version."); + } + + if (!TestBackupVersionCompatibility(manifest.BackupEngineVersion)) + { + throw new NotSupportedException($"The loaded archive '{archivePath}' is made for a newer version of Jellyfin ({manifest.ServerVersion}) and cannot be loaded in this version."); + } + + void CopyDirectory(string source, string target) + { + var fullSourcePath = NormalizePathSeparator(Path.GetFullPath(source) + Path.DirectorySeparatorChar); + var fullTargetRoot = Path.GetFullPath(target) + Path.DirectorySeparatorChar; + foreach (var item in zipArchive.Entries) + { + var sourcePath = NormalizePathSeparator(Path.GetFullPath(item.FullName)); + var targetPath = Path.GetFullPath(Path.Combine(target, Path.GetRelativePath(source, item.FullName))); + + if (!sourcePath.StartsWith(fullSourcePath, StringComparison.Ordinal) + || !targetPath.StartsWith(fullTargetRoot, StringComparison.Ordinal)) + { + continue; + } + + _logger.LogInformation("Restore and override {File}", targetPath); + + Directory.CreateDirectory(Path.GetDirectoryName(targetPath)!); + item.ExtractToFile(targetPath, overwrite: true); + } + } + + CopyDirectory("Config", _applicationPaths.ConfigurationDirectoryPath); + CopyDirectory("Data", _applicationPaths.DataPath); + CopyDirectory("Root", _applicationPaths.RootFolderPath); + + if (manifest.Options.Database) + { + _logger.LogInformation("Begin restoring Database"); + var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); + await using (dbContext.ConfigureAwait(false)) + { + // restore migration history manually + var historyEntry = zipArchive.GetEntry(NormalizePathSeparator(Path.Combine("Database", $"{nameof(HistoryRow)}.json"))); + if (historyEntry is null) + { + _logger.LogInformation("No backup of the history table in archive. This is required for Jellyfin operation"); + throw new InvalidOperationException("Cannot restore backup that has no History data."); + } + + HistoryRow[] historyEntries; + var historyArchive = historyEntry.Open(); + await using (historyArchive.ConfigureAwait(false)) + { + historyEntries = await JsonSerializer.DeserializeAsync<HistoryRow[]>(historyArchive).ConfigureAwait(false) ?? + throw new InvalidOperationException("Cannot restore backup that has no History data."); + } + + var historyRepository = dbContext.GetService<IHistoryRepository>(); + await historyRepository.CreateIfNotExistsAsync().ConfigureAwait(false); + + foreach (var item in await historyRepository.GetAppliedMigrationsAsync(CancellationToken.None).ConfigureAwait(false)) + { + var insertScript = historyRepository.GetDeleteScript(item.MigrationId); + await dbContext.Database.ExecuteSqlRawAsync(insertScript).ConfigureAwait(false); + } + + foreach (var item in historyEntries) + { + var insertScript = historyRepository.GetInsertScript(item); + await dbContext.Database.ExecuteSqlRawAsync(insertScript).ConfigureAwait(false); + } + + dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; + var entityTypes = typeof(JellyfinDbContext).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) + .Where(e => e.PropertyType.IsAssignableTo(typeof(IQueryable))) + .Select(e => (Type: e, Set: e.GetValue(dbContext) as IQueryable)) + .ToArray(); + + var tableNames = entityTypes.Select(f => dbContext.Model.FindEntityType(f.Type.PropertyType.GetGenericArguments()[0])!.GetSchemaQualifiedTableName()!); + _logger.LogInformation("Begin purging database"); + await _jellyfinDatabaseProvider.PurgeDatabase(dbContext, tableNames).ConfigureAwait(false); + _logger.LogInformation("Database Purged"); + + foreach (var entityType in entityTypes) + { + _logger.LogInformation("Read backup of {Table}", entityType.Type.Name); + + var zipEntry = zipArchive.GetEntry(NormalizePathSeparator(Path.Combine("Database", $"{entityType.Type.Name}.json"))); + if (zipEntry is null) + { + _logger.LogInformation("No backup of expected table {Table} is present in backup. Continue anyway.", entityType.Type.Name); + continue; + } + + var zipEntryStream = zipEntry.Open(); + await using (zipEntryStream.ConfigureAwait(false)) + { + _logger.LogInformation("Restore backup of {Table}", entityType.Type.Name); + var records = 0; + await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<JsonObject>(zipEntryStream, _serializerSettings).ConfigureAwait(false)) + { + var entity = item.Deserialize(entityType.Type.PropertyType.GetGenericArguments()[0]); + if (entity is null) + { + throw new InvalidOperationException($"Cannot deserialize entity '{item}'"); + } + + try + { + records++; + dbContext.Add(entity); + } + catch (Exception ex) + { + _logger.LogError(ex, "Could not store entity {Entity} continue anyway.", item); + } + } + + _logger.LogInformation("Prepared to restore {Number} entries for {Table}", records, entityType.Type.Name); + } + } + + _logger.LogInformation("Try restore Database"); + await dbContext.SaveChangesAsync().ConfigureAwait(false); + _logger.LogInformation("Restored database."); + } + } + + _logger.LogInformation("Restored Jellyfin system from {Date}.", manifest.DateCreated); + } + } + + private bool TestBackupVersionCompatibility(Version backupEngineVersion) + { + if (backupEngineVersion == _backupEngineVersion) + { + return true; + } + + return false; + } + + /// <inheritdoc/> + public async Task<BackupManifestDto> CreateBackupAsync(BackupOptionsDto backupOptions) + { + var manifest = new BackupManifest() + { + DateCreated = DateTime.UtcNow, + ServerVersion = _applicationHost.ApplicationVersion, + DatabaseTables = null!, + BackupEngineVersion = _backupEngineVersion, + Options = Map(backupOptions) + }; + + await _jellyfinDatabaseProvider.RunScheduledOptimisation(CancellationToken.None).ConfigureAwait(false); + + var backupFolder = Path.Combine(_applicationPaths.BackupPath); + + if (!Directory.Exists(backupFolder)) + { + Directory.CreateDirectory(backupFolder); + } + + var backupStorageSpace = StorageHelper.GetFreeSpaceOf(_applicationPaths.BackupPath); + + const long FiveGigabyte = 5_368_709_115; + if (backupStorageSpace.FreeSpace < FiveGigabyte) + { + throw new InvalidOperationException($"The backup directory '{backupStorageSpace.Path}' does not have at least '{StorageHelper.HumanizeStorageSize(FiveGigabyte)}' free space. Cannot create backup."); + } + + var backupPath = Path.Combine(backupFolder, $"jellyfin-backup-{manifest.DateCreated.ToLocalTime():yyyyMMddHHmmss}.zip"); + _logger.LogInformation("Attempt to create a new backup at {BackupPath}", backupPath); + var fileStream = File.OpenWrite(backupPath); + await using (fileStream.ConfigureAwait(false)) + using (var zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Create, false)) + { + _logger.LogInformation("Start backup process."); + var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); + await using (dbContext.ConfigureAwait(false)) + { + dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; + static IAsyncEnumerable<object> GetValues(IQueryable dbSet) + { + var method = dbSet.GetType().GetMethod(nameof(DbSet<object>.AsAsyncEnumerable))!; + var enumerable = method.Invoke(dbSet, null)!; + return (IAsyncEnumerable<object>)enumerable; + } + + // include the migration history as well + var historyRepository = dbContext.GetService<IHistoryRepository>(); + var migrations = await historyRepository.GetAppliedMigrationsAsync().ConfigureAwait(false); + + ICollection<(Type Type, string SourceName, Func<IAsyncEnumerable<object>> ValueFactory)> entityTypes = [ + .. typeof(JellyfinDbContext) + .GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) + .Where(e => e.PropertyType.IsAssignableTo(typeof(IQueryable))) + .Select(e => (Type: e.PropertyType, dbContext.Model.FindEntityType(e.PropertyType.GetGenericArguments()[0])!.GetSchemaQualifiedTableName()!, ValueFactory: new Func<IAsyncEnumerable<object>>(() => GetValues((IQueryable)e.GetValue(dbContext)!)))), + (Type: typeof(HistoryRow), SourceName: nameof(HistoryRow), ValueFactory: () => migrations.ToAsyncEnumerable()) + ]; + manifest.DatabaseTables = entityTypes.Select(e => e.Type.Name).ToArray(); + var transaction = await dbContext.Database.BeginTransactionAsync().ConfigureAwait(false); + + await using (transaction.ConfigureAwait(false)) + { + _logger.LogInformation("Begin Database backup"); + + foreach (var entityType in entityTypes) + { + _logger.LogInformation("Begin backup of entity {Table}", entityType.SourceName); + var zipEntry = zipArchive.CreateEntry(NormalizePathSeparator(Path.Combine("Database", $"{entityType.SourceName}.json"))); + var entities = 0; + var zipEntryStream = zipEntry.Open(); + await using (zipEntryStream.ConfigureAwait(false)) + { + var jsonSerializer = new Utf8JsonWriter(zipEntryStream); + await using (jsonSerializer.ConfigureAwait(false)) + { + jsonSerializer.WriteStartArray(); + + var set = entityType.ValueFactory().ConfigureAwait(false); + await foreach (var item in set.ConfigureAwait(false)) + { + entities++; + try + { + JsonSerializer.SerializeToDocument(item, _serializerSettings).WriteTo(jsonSerializer); + } + catch (Exception ex) + { + _logger.LogError(ex, "Could not load entity {Entity}", item); + throw; + } + } + + jsonSerializer.WriteEndArray(); + } + } + + _logger.LogInformation("backup of entity {Table} with {Number} created", entityType.Type.Name, entities); + } + } + } + + _logger.LogInformation("Backup of folder {Table}", _applicationPaths.ConfigurationDirectoryPath); + foreach (var item in Directory.EnumerateFiles(_applicationPaths.ConfigurationDirectoryPath, "*.xml", SearchOption.TopDirectoryOnly) + .Union(Directory.EnumerateFiles(_applicationPaths.ConfigurationDirectoryPath, "*.json", SearchOption.TopDirectoryOnly))) + { + zipArchive.CreateEntryFromFile(item, NormalizePathSeparator(Path.Combine("Config", Path.GetFileName(item)))); + } + + void CopyDirectory(string source, string target, string filter = "*") + { + if (!Directory.Exists(source)) + { + return; + } + + _logger.LogInformation("Backup of folder {Table}", source); + + foreach (var item in Directory.EnumerateFiles(source, filter, SearchOption.AllDirectories)) + { + zipArchive.CreateEntryFromFile(item, NormalizePathSeparator(Path.Combine(target, Path.GetRelativePath(source, item)))); + } + } + + CopyDirectory(Path.Combine(_applicationPaths.ConfigurationDirectoryPath, "users"), Path.Combine("Config", "users")); + CopyDirectory(Path.Combine(_applicationPaths.ConfigurationDirectoryPath, "ScheduledTasks"), Path.Combine("Config", "ScheduledTasks")); + CopyDirectory(Path.Combine(_applicationPaths.RootFolderPath), "Root"); + CopyDirectory(Path.Combine(_applicationPaths.DataPath, "collections"), Path.Combine("Data", "collections")); + CopyDirectory(Path.Combine(_applicationPaths.DataPath, "playlists"), Path.Combine("Data", "playlists")); + CopyDirectory(Path.Combine(_applicationPaths.DataPath, "ScheduledTasks"), Path.Combine("Data", "ScheduledTasks")); + if (backupOptions.Subtitles) + { + CopyDirectory(Path.Combine(_applicationPaths.DataPath, "subtitles"), Path.Combine("Data", "subtitles")); + } + + if (backupOptions.Trickplay) + { + CopyDirectory(Path.Combine(_applicationPaths.DataPath, "trickplay"), Path.Combine("Data", "trickplay")); + } + + if (backupOptions.Metadata) + { + CopyDirectory(Path.Combine(_applicationPaths.InternalMetadataPath), Path.Combine("Data", "metadata")); + } + + var manifestStream = zipArchive.CreateEntry(ManifestEntryName).Open(); + await using (manifestStream.ConfigureAwait(false)) + { + await JsonSerializer.SerializeAsync(manifestStream, manifest).ConfigureAwait(false); + } + } + + _logger.LogInformation("Backup created"); + return Map(manifest, backupPath); + } + + /// <inheritdoc/> + public async Task<BackupManifestDto?> GetBackupManifest(string archivePath) + { + if (!File.Exists(archivePath)) + { + return null; + } + + BackupManifest? manifest; + try + { + manifest = await GetManifest(archivePath).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.LogError(ex, "Tried to load archive from {Path} but failed.", archivePath); + return null; + } + + if (manifest is null) + { + return null; + } + + return Map(manifest, archivePath); + } + + /// <inheritdoc/> + public async Task<BackupManifestDto[]> EnumerateBackups() + { + if (!Directory.Exists(_applicationPaths.BackupPath)) + { + return []; + } + + var archives = Directory.EnumerateFiles(_applicationPaths.BackupPath, "*.zip"); + var manifests = new List<BackupManifestDto>(); + foreach (var item in archives) + { + try + { + var manifest = await GetManifest(item).ConfigureAwait(false); + + if (manifest is null) + { + continue; + } + + manifests.Add(Map(manifest, item)); + } + catch (Exception ex) + { + _logger.LogError(ex, "Could not load {BackupArchive} path.", item); + } + } + + return manifests.ToArray(); + } + + private static async ValueTask<BackupManifest?> GetManifest(string archivePath) + { + var archiveStream = File.OpenRead(archivePath); + await using (archiveStream.ConfigureAwait(false)) + { + using var zipStream = new ZipArchive(archiveStream, ZipArchiveMode.Read); + var manifestEntry = zipStream.GetEntry(ManifestEntryName); + if (manifestEntry is null) + { + return null; + } + + var manifestStream = manifestEntry.Open(); + await using (manifestStream.ConfigureAwait(false)) + { + return await JsonSerializer.DeserializeAsync<BackupManifest>(manifestStream, _serializerSettings).ConfigureAwait(false); + } + } + } + + private static BackupManifestDto Map(BackupManifest manifest, string path) + { + return new BackupManifestDto() + { + BackupEngineVersion = manifest.BackupEngineVersion, + DateCreated = manifest.DateCreated, + ServerVersion = manifest.ServerVersion, + Path = path, + Options = Map(manifest.Options) + }; + } + + private static BackupOptionsDto Map(BackupOptions options) + { + return new BackupOptionsDto() + { + Metadata = options.Metadata, + Subtitles = options.Subtitles, + Trickplay = options.Trickplay, + Database = options.Database + }; + } + + private static BackupOptions Map(BackupOptionsDto options) + { + return new BackupOptions() + { + Metadata = options.Metadata, + Subtitles = options.Subtitles, + Trickplay = options.Trickplay, + Database = options.Database + }; + } + + /// <summary> + /// Windows is able to handle '/' as a path seperator in zip files + /// but linux isn't able to handle '\' as a path seperator in zip files, + /// So normalize to '/'. + /// </summary> + /// <param name="path">The path to normalize.</param> + /// <returns>The normalized path. </returns> + private static string NormalizePathSeparator(string path) + => path.Replace('\\', '/'); +} diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs index 392b7de74..d59eba690 100644 --- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs +++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs @@ -7,19 +7,21 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Collections.Immutable; using System.Globalization; -using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; using System.Text.Json; using System.Threading; -using Jellyfin.Data.Entities; +using System.Threading.Tasks; using Jellyfin.Data.Enums; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; +using Jellyfin.Database.Implementations.Enums; using Jellyfin.Extensions; using Jellyfin.Extensions.Json; +using Jellyfin.Server.Implementations.Extensions; using MediaBrowser.Common; using MediaBrowser.Controller; using MediaBrowser.Controller.Channels; @@ -36,7 +38,7 @@ using MediaBrowser.Model.Querying; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using BaseItemDto = MediaBrowser.Controller.Entities.BaseItem; -using BaseItemEntity = Jellyfin.Data.Entities.BaseItemEntity; +using BaseItemEntity = Jellyfin.Database.Implementations.Entities.BaseItemEntity; namespace Jellyfin.Server.Implementations.Item; @@ -53,6 +55,11 @@ public sealed class BaseItemRepository : IItemRepository { /// <summary> + /// Gets the placeholder id for UserData detached items. + /// </summary> + public static readonly Guid PlaceholderId = Guid.Parse("00000000-0000-0000-0000-000000000001"); + + /// <summary> /// This holds all the types in the running assemblies /// so that we can de-serialize properly when we don't have strong types. /// </summary> @@ -67,7 +74,7 @@ public sealed class BaseItemRepository private static readonly IReadOnlyList<ItemValueType> _getArtistValueTypes = [ItemValueType.Artist]; private static readonly IReadOnlyList<ItemValueType> _getAlbumArtistValueTypes = [ItemValueType.AlbumArtist]; private static readonly IReadOnlyList<ItemValueType> _getStudiosValueTypes = [ItemValueType.Studios]; - private static readonly IReadOnlyList<ItemValueType> _getGenreValueTypes = [ItemValueType.Studios]; + private static readonly IReadOnlyList<ItemValueType> _getGenreValueTypes = [ItemValueType.Genre]; /// <summary> /// Initializes a new instance of the <see cref="BaseItemRepository"/> class. @@ -94,23 +101,53 @@ public sealed class BaseItemRepository /// <inheritdoc /> public void DeleteItem(Guid id) { - if (id.IsEmpty()) + if (id.IsEmpty() || id.Equals(PlaceholderId)) { - throw new ArgumentException("Guid can't be empty", nameof(id)); + throw new ArgumentException("Guid can't be empty or the placeholder id.", nameof(id)); } using var context = _dbProvider.CreateDbContext(); using var transaction = context.Database.BeginTransaction(); - context.PeopleBaseItemMap.Where(e => e.ItemId == id).ExecuteDelete(); - context.Peoples.Where(e => e.BaseItems!.Count == 0).ExecuteDelete(); - context.Chapters.Where(e => e.ItemId == id).ExecuteDelete(); - context.MediaStreamInfos.Where(e => e.ItemId == id).ExecuteDelete(); + + var date = (DateTime?)DateTime.UtcNow; + + // Remove any UserData entries for the placeholder item that would conflict with the UserData + // being detached from the item being deleted. This is necessary because, during an update, + // UserData may be reattached to a new entry, but some entries can be left behind. + // Ensures there are no duplicate UserId/CustomDataKey combinations for the placeholder. + context.UserData + .Join( + context.UserData.Where(e => e.ItemId == id), + placeholder => new { placeholder.UserId, placeholder.CustomDataKey }, + userData => new { userData.UserId, userData.CustomDataKey }, + (placeholder, userData) => placeholder) + .Where(e => e.ItemId == PlaceholderId) + .ExecuteDelete(); + + // Detach all user watch data + context.UserData.Where(e => e.ItemId == id) + .ExecuteUpdate(e => e + .SetProperty(f => f.RetentionDate, date) + .SetProperty(f => f.ItemId, PlaceholderId)); + context.AncestorIds.Where(e => e.ItemId == id || e.ParentItemId == id).ExecuteDelete(); - context.ItemValuesMap.Where(e => e.ItemId == id).ExecuteDelete(); - context.ItemValues.Where(e => e.BaseItemsMap!.Count == 0).ExecuteDelete(); + context.AttachmentStreamInfos.Where(e => e.ItemId == id).ExecuteDelete(); context.BaseItemImageInfos.Where(e => e.ItemId == id).ExecuteDelete(); + context.BaseItemMetadataFields.Where(e => e.ItemId == id).ExecuteDelete(); context.BaseItemProviders.Where(e => e.ItemId == id).ExecuteDelete(); + context.BaseItemTrailerTypes.Where(e => e.ItemId == id).ExecuteDelete(); context.BaseItems.Where(e => e.Id == id).ExecuteDelete(); + context.Chapters.Where(e => e.ItemId == id).ExecuteDelete(); + context.CustomItemDisplayPreferences.Where(e => e.ItemId == id).ExecuteDelete(); + context.ItemDisplayPreferences.Where(e => e.ItemId == id).ExecuteDelete(); + context.ItemValues.Where(e => e.BaseItemsMap!.Count == 0).ExecuteDelete(); + context.ItemValuesMap.Where(e => e.ItemId == id).ExecuteDelete(); + context.KeyframeData.Where(e => e.ItemId == id).ExecuteDelete(); + context.MediaSegments.Where(e => e.ItemId == id).ExecuteDelete(); + context.MediaStreamInfos.Where(e => e.ItemId == id).ExecuteDelete(); + context.PeopleBaseItemMap.Where(e => e.ItemId == id).ExecuteDelete(); + context.Peoples.Where(e => e.BaseItems!.Count == 0).ExecuteDelete(); + context.TrickplayInfos.Where(e => e.ItemId == id).ExecuteDelete(); context.SaveChanges(); transaction.Commit(); } @@ -135,41 +172,41 @@ public sealed class BaseItemRepository PrepareFilterQuery(filter); using var context = _dbProvider.CreateDbContext(); - return ApplyQueryFilter(context.BaseItems.AsNoTracking(), context, filter).Select(e => e.Id).ToArray(); + return ApplyQueryFilter(context.BaseItems.AsNoTracking().Where(e => e.Id != EF.Constant(PlaceholderId)), context, filter).Select(e => e.Id).ToArray(); } /// <inheritdoc /> - public QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery filter) + public QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetAllArtists(InternalItemsQuery filter) { return GetItemValues(filter, _getAllArtistsValueTypes, _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicArtist]); } /// <inheritdoc /> - public QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery filter) + public QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetArtists(InternalItemsQuery filter) { return GetItemValues(filter, _getArtistValueTypes, _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicArtist]); } /// <inheritdoc /> - public QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery filter) + public QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetAlbumArtists(InternalItemsQuery filter) { return GetItemValues(filter, _getAlbumArtistValueTypes, _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicArtist]); } /// <inheritdoc /> - public QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery filter) + public QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetStudios(InternalItemsQuery filter) { return GetItemValues(filter, _getStudiosValueTypes, _itemTypeLookup.BaseItemKindNames[BaseItemKind.Studio]); } /// <inheritdoc /> - public QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery filter) + public QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetGenres(InternalItemsQuery filter) { return GetItemValues(filter, _getGenreValueTypes, _itemTypeLookup.BaseItemKindNames[BaseItemKind.Genre]); } /// <inheritdoc /> - public QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery filter) + public QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetMusicGenres(InternalItemsQuery filter) { return GetItemValues(filter, _getGenreValueTypes, _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicGenre]); } @@ -233,7 +270,7 @@ public sealed class BaseItemRepository dbQuery = ApplyGroupingFilter(dbQuery, filter); dbQuery = ApplyQueryPaging(dbQuery, filter); - result.Items = dbQuery.AsEnumerable().Where(e => e is not null).Select(w => DeserialiseBaseItem(w, filter.SkipDeserialization)).ToArray(); + result.Items = dbQuery.AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray(); result.StartIndex = filter.StartIndex ?? 0; return result; } @@ -252,7 +289,80 @@ public sealed class BaseItemRepository dbQuery = ApplyGroupingFilter(dbQuery, filter); dbQuery = ApplyQueryPaging(dbQuery, filter); - return dbQuery.AsEnumerable().Where(e => e is not null).Select(w => DeserialiseBaseItem(w, filter.SkipDeserialization)).ToArray(); + return dbQuery.AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray(); + } + + /// <inheritdoc/> + public IReadOnlyList<BaseItem> GetLatestItemList(InternalItemsQuery filter, CollectionType collectionType) + { + ArgumentNullException.ThrowIfNull(filter); + PrepareFilterQuery(filter); + + // Early exit if collection type is not tvshows or music + if (collectionType != CollectionType.tvshows && collectionType != CollectionType.music) + { + return Array.Empty<BaseItem>(); + } + + using var context = _dbProvider.CreateDbContext(); + + // Subquery to group by SeriesNames/Album and get the max Date Created for each group. + var subquery = PrepareItemQuery(context, filter); + subquery = TranslateQuery(subquery, context, filter); + var subqueryGrouped = subquery.GroupBy(g => collectionType == CollectionType.tvshows ? g.SeriesName : g.Album) + .Select(g => new + { + Key = g.Key, + MaxDateCreated = g.Max(a => a.DateCreated) + }) + .OrderByDescending(g => g.MaxDateCreated) + .Select(g => g); + + if (filter.Limit.HasValue) + { + subqueryGrouped = subqueryGrouped.Take(filter.Limit.Value); + } + + filter.Limit = null; + + var mainquery = PrepareItemQuery(context, filter); + mainquery = TranslateQuery(mainquery, context, filter); + mainquery = mainquery.Where(g => g.DateCreated >= subqueryGrouped.Min(s => s.MaxDateCreated)); + mainquery = ApplyGroupingFilter(mainquery, filter); + mainquery = ApplyQueryPaging(mainquery, filter); + + return mainquery.AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray(); + } + + /// <inheritdoc /> + public IReadOnlyList<string> GetNextUpSeriesKeys(InternalItemsQuery filter, DateTime dateCutoff) + { + ArgumentNullException.ThrowIfNull(filter); + ArgumentNullException.ThrowIfNull(filter.User); + + using var context = _dbProvider.CreateDbContext(); + + var query = context.BaseItems + .AsNoTracking() + .Where(i => filter.TopParentIds.Contains(i.TopParentId!.Value)) + .Where(i => i.Type == _itemTypeLookup.BaseItemKindNames[BaseItemKind.Episode]) + .Join( + context.UserData.AsNoTracking().Where(e => e.ItemId != EF.Constant(PlaceholderId)), + i => new { UserId = filter.User.Id, ItemId = i.Id }, + u => new { UserId = u.UserId, ItemId = u.ItemId }, + (entity, data) => new { Item = entity, UserData = data }) + .GroupBy(g => g.Item.SeriesPresentationUniqueKey) + .Select(g => new { g.Key, LastPlayedDate = g.Max(u => u.UserData.LastPlayedDate) }) + .Where(g => g.Key != null && g.LastPlayedDate != null && g.LastPlayedDate >= dateCutoff) + .OrderByDescending(g => g.LastPlayedDate) + .Select(g => g.Key!); + + if (filter.Limit.HasValue) + { + query = query.Take(filter.Limit.Value); + } + + return query.ToArray(); } private IQueryable<BaseItemEntity> ApplyGroupingFilter(IQueryable<BaseItemEntity> dbQuery, InternalItemsQuery filter) @@ -320,7 +430,8 @@ public sealed class BaseItemRepository private IQueryable<BaseItemEntity> PrepareItemQuery(JellyfinDbContext context, InternalItemsQuery filter) { - IQueryable<BaseItemEntity> dbQuery = context.BaseItems.AsNoTracking().AsSplitQuery() + IQueryable<BaseItemEntity> dbQuery = context.BaseItems.AsNoTracking(); + dbQuery = dbQuery.AsSingleQuery() .Include(e => e.TrailerTypes) .Include(e => e.Provider) .Include(e => e.LockedFields); @@ -371,11 +482,16 @@ public sealed class BaseItemRepository var images = item.ImageInfos.Select(e => Map(item.Id, e)); using var context = _dbProvider.CreateDbContext(); - using var transaction = context.Database.BeginTransaction(); + + if (!context.BaseItems.Any(bi => bi.Id == item.Id)) + { + _logger.LogWarning("Unable to save ImageInfo for non existing BaseItem"); + return; + } + context.BaseItemImageInfos.Where(e => e.ItemId == item.Id).ExecuteDelete(); context.BaseItemImageInfos.AddRange(images); context.SaveChanges(); - transaction.Commit(); } /// <inheritdoc /> @@ -391,7 +507,7 @@ public sealed class BaseItemRepository cancellationToken.ThrowIfCancellationRequested(); var tuples = new List<(BaseItemDto Item, List<Guid>? AncestorIds, BaseItemDto TopParent, IEnumerable<string> UserDataKey, List<string> InheritedTags)>(); - foreach (var item in items.GroupBy(e => e.Id).Select(e => e.Last())) + foreach (var item in items.GroupBy(e => e.Id).Select(e => e.Last()).Where(e => e.Id != PlaceholderId)) { var ancestorIds = item.SupportsAncestors ? item.GetAncestorIds().Distinct().ToList() : @@ -405,17 +521,20 @@ public sealed class BaseItemRepository tuples.Add((item, ancestorIds, topParent, userdataKey, inheritedTags)); } - var localItemValueCache = new Dictionary<(int MagicNumber, string Value), Guid>(); - using var context = _dbProvider.CreateDbContext(); using var transaction = context.Database.BeginTransaction(); + + var ids = tuples.Select(f => f.Item.Id).ToArray(); + var existingItems = context.BaseItems.Where(e => ids.Contains(e.Id)).Select(f => f.Id).ToArray(); + var newItems = tuples.Where(e => !existingItems.Contains(e.Item.Id)).ToArray(); + foreach (var item in tuples) { var entity = Map(item.Item); // TODO: refactor this "inconsistency" entity.TopParentId = item.TopParent?.Id; - if (!context.BaseItems.Any(e => e.Id == entity.Id)) + if (!existingItems.Any(e => e == entity.Id)) { context.BaseItems.Add(entity); } @@ -424,59 +543,111 @@ public sealed class BaseItemRepository context.BaseItemProviders.Where(e => e.ItemId == entity.Id).ExecuteDelete(); context.BaseItems.Attach(entity).State = EntityState.Modified; } + } - context.AncestorIds.Where(e => e.ItemId == entity.Id).ExecuteDelete(); - if (item.Item.SupportsAncestors && item.AncestorIds != null) + context.SaveChanges(); + + foreach (var item in newItems) + { + // reattach old userData entries + var userKeys = item.UserDataKey.ToArray(); + var retentionDate = (DateTime?)null; + context.UserData + .Where(e => e.ItemId == PlaceholderId) + .Where(e => userKeys.Contains(e.CustomDataKey)) + .ExecuteUpdate(e => e + .SetProperty(f => f.ItemId, item.Item.Id) + .SetProperty(f => f.RetentionDate, retentionDate)); + } + + var itemValueMaps = tuples + .Select(e => (e.Item, Values: GetItemValuesToSave(e.Item, e.InheritedTags))) + .ToArray(); + var allListedItemValues = itemValueMaps + .SelectMany(f => f.Values) + .Distinct() + .ToArray(); + var existingValues = context.ItemValues + .Select(e => new { - foreach (var ancestorId in item.AncestorIds) - { - if (!context.BaseItems.Any(f => f.Id == ancestorId)) - { - continue; - } + item = e, + Key = e.Type + "+" + e.Value + }) + .Where(f => allListedItemValues.Select(e => $"{(int)e.MagicNumber}+{e.Value}").Contains(f.Key)) + .Select(e => e.item) + .ToArray(); + var missingItemValues = allListedItemValues.Except(existingValues.Select(f => (MagicNumber: f.Type, f.Value))).Select(f => new ItemValue() + { + CleanValue = GetCleanValue(f.Value), + ItemValueId = Guid.NewGuid(), + Type = f.MagicNumber, + Value = f.Value + }).ToArray(); + context.ItemValues.AddRange(missingItemValues); + context.SaveChanges(); - context.AncestorIds.Add(new AncestorId() + var itemValuesStore = existingValues.Concat(missingItemValues).ToArray(); + var valueMap = itemValueMaps + .Select(f => (f.Item, Values: f.Values.Select(e => itemValuesStore.First(g => g.Value == e.Value && g.Type == e.MagicNumber)).DistinctBy(e => e.ItemValueId).ToArray())) + .ToArray(); + + var mappedValues = context.ItemValuesMap.Where(e => ids.Contains(e.ItemId)).ToList(); + + foreach (var item in valueMap) + { + var itemMappedValues = mappedValues.Where(e => e.ItemId == item.Item.Id).ToList(); + foreach (var itemValue in item.Values) + { + var existingItem = itemMappedValues.FirstOrDefault(f => f.ItemValueId == itemValue.ItemValueId); + if (existingItem is null) + { + context.ItemValuesMap.Add(new ItemValueMap() { - ParentItemId = ancestorId, - ItemId = entity.Id, Item = null!, - ParentItem = null! + ItemId = item.Item.Id, + ItemValue = null!, + ItemValueId = itemValue.ItemValueId }); } - } - - // Never save duplicate itemValues as they are now mapped anyway. - var itemValuesToSave = GetItemValuesToSave(item.Item, item.InheritedTags).DistinctBy(e => (GetCleanValue(e.Value), e.MagicNumber)); - context.ItemValuesMap.Where(e => e.ItemId == entity.Id).ExecuteDelete(); - foreach (var itemValue in itemValuesToSave) - { - if (!localItemValueCache.TryGetValue(itemValue, out var refValue)) + else { - refValue = context.ItemValues - .Where(f => f.CleanValue == GetCleanValue(itemValue.Value) && (int)f.Type == itemValue.MagicNumber) - .Select(e => e.ItemValueId) - .FirstOrDefault(); + // map exists, remove from list so its been handled. + itemMappedValues.Remove(existingItem); } + } + + // all still listed values are not in the new list so remove them. + context.ItemValuesMap.RemoveRange(itemMappedValues); + } - if (refValue.IsEmpty()) + context.SaveChanges(); + + foreach (var item in tuples) + { + if (item.Item.SupportsAncestors && item.AncestorIds != null) + { + var existingAncestorIds = context.AncestorIds.Where(e => e.ItemId == item.Item.Id).ToList(); + var validAncestorIds = context.BaseItems.Where(e => item.AncestorIds.Contains(e.Id)).Select(f => f.Id).ToArray(); + foreach (var ancestorId in validAncestorIds) { - context.ItemValues.Add(new ItemValue() + var existingAncestorId = existingAncestorIds.FirstOrDefault(e => e.ParentItemId == ancestorId); + if (existingAncestorId is null) { - CleanValue = GetCleanValue(itemValue.Value), - Type = (ItemValueType)itemValue.MagicNumber, - ItemValueId = refValue = Guid.NewGuid(), - Value = itemValue.Value - }); - localItemValueCache[itemValue] = refValue; + context.AncestorIds.Add(new AncestorId() + { + ParentItemId = ancestorId, + ItemId = item.Item.Id, + Item = null!, + ParentItem = null! + }); + } + else + { + existingAncestorIds.Remove(existingAncestorId); + } } - context.ItemValuesMap.Add(new ItemValueMap() - { - Item = null!, - ItemId = entity.Id, - ItemValue = null!, - ItemValueId = refValue - }); + context.AncestorIds.RemoveRange(existingAncestorIds); } } @@ -505,7 +676,7 @@ public sealed class BaseItemRepository return null; } - return DeserialiseBaseItem(item); + return DeserializeBaseItem(item); } /// <summary> @@ -538,6 +709,7 @@ public sealed class BaseItemRepository dto.PreferredMetadataCountryCode = entity.PreferredMetadataCountryCode; dto.IsInMixedFolder = entity.IsInMixedFolder; dto.InheritedParentalRatingValue = entity.InheritedParentalRatingValue; + dto.InheritedParentalRatingSubValue = entity.InheritedParentalRatingSubValue; dto.CriticRating = entity.CriticRating; dto.PresentationUniqueKey = entity.PresentationUniqueKey; dto.OriginalTitle = entity.OriginalTitle; @@ -550,12 +722,12 @@ public sealed class BaseItemRepository dto.TotalBitrate = entity.TotalBitrate; dto.ExternalId = entity.ExternalId; dto.Size = entity.Size; - dto.Genres = entity.Genres?.Split('|') ?? []; - dto.DateCreated = entity.DateCreated.GetValueOrDefault(); - dto.DateModified = entity.DateModified.GetValueOrDefault(); + dto.Genres = string.IsNullOrWhiteSpace(entity.Genres) ? [] : entity.Genres.Split('|'); + dto.DateCreated = entity.DateCreated ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); + dto.DateModified = entity.DateModified ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); dto.ChannelId = entity.ChannelId ?? Guid.Empty; - dto.DateLastRefreshed = entity.DateLastRefreshed.GetValueOrDefault(); - dto.DateLastSaved = entity.DateLastSaved.GetValueOrDefault(); + dto.DateLastRefreshed = entity.DateLastRefreshed ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); + dto.DateLastSaved = entity.DateLastSaved ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); dto.OwnerId = string.IsNullOrWhiteSpace(entity.OwnerId) ? Guid.Empty : (Guid.TryParse(entity.OwnerId, out var ownerId) ? ownerId : Guid.Empty); dto.Width = entity.Width.GetValueOrDefault(); dto.Height = entity.Height.GetValueOrDefault(); @@ -582,7 +754,7 @@ public sealed class BaseItemRepository dto.ExtraIds = string.IsNullOrWhiteSpace(entity.ExtraIds) ? [] : entity.ExtraIds.Split('|').Select(e => Guid.Parse(e)).ToArray(); dto.ProductionLocations = entity.ProductionLocations?.Split('|') ?? []; dto.Studios = entity.Studios?.Split('|') ?? []; - dto.Tags = entity.Tags?.Split('|') ?? []; + dto.Tags = string.IsNullOrWhiteSpace(entity.Tags) ? [] : entity.Tags.Split('|'); if (dto is IHasProgramAttributes hasProgramAttributes) { @@ -656,7 +828,7 @@ public sealed class BaseItemRepository if (dto is Folder folder) { - folder.DateLastMediaAdded = entity.DateLastMediaAdded; + folder.DateLastMediaAdded = entity.DateLastMediaAdded ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); } return dto; @@ -702,6 +874,7 @@ public sealed class BaseItemRepository entity.PreferredMetadataCountryCode = dto.PreferredMetadataCountryCode; entity.IsInMixedFolder = dto.IsInMixedFolder; entity.InheritedParentalRatingValue = dto.InheritedParentalRatingValue; + entity.InheritedParentalRatingSubValue = dto.InheritedParentalRatingSubValue; entity.CriticRating = dto.CriticRating; entity.PresentationUniqueKey = dto.PresentationUniqueKey; entity.OriginalTitle = dto.OriginalTitle; @@ -715,11 +888,11 @@ public sealed class BaseItemRepository entity.ExternalId = dto.ExternalId; entity.Size = dto.Size; entity.Genres = string.Join('|', dto.Genres); - entity.DateCreated = dto.DateCreated; - entity.DateModified = dto.DateModified; + entity.DateCreated = dto.DateCreated == DateTime.MinValue ? null : dto.DateCreated; + entity.DateModified = dto.DateModified == DateTime.MinValue ? null : dto.DateModified; entity.ChannelId = dto.ChannelId; - entity.DateLastRefreshed = dto.DateLastRefreshed; - entity.DateLastSaved = dto.DateLastSaved; + entity.DateLastRefreshed = dto.DateLastRefreshed == DateTime.MinValue ? null : dto.DateLastRefreshed; + entity.DateLastSaved = dto.DateLastSaved == DateTime.MinValue ? null : dto.DateLastSaved; entity.OwnerId = dto.OwnerId.ToString(); entity.Width = dto.Width; entity.Height = dto.Height; @@ -829,7 +1002,7 @@ public sealed class BaseItemRepository if (dto is Folder folder) { - entity.DateLastMediaAdded = folder.DateLastMediaAdded; + entity.DateLastMediaAdded = folder.DateLastMediaAdded == DateTime.MinValue ? null : folder.DateLastMediaAdded; entity.IsFolder = folder.IsFolder; } @@ -865,7 +1038,7 @@ public sealed class BaseItemRepository return type.GetCustomAttribute<RequiresSourceSerialisationAttribute>() == null; } - private BaseItemDto DeserialiseBaseItem(BaseItemEntity baseItemEntity, bool skipDeserialization = false) + private BaseItemDto DeserializeBaseItem(BaseItemEntity baseItemEntity, bool skipDeserialization = false) { ArgumentNullException.ThrowIfNull(baseItemEntity, nameof(baseItemEntity)); if (_serverConfigurationManager?.Configuration is null) @@ -874,7 +1047,7 @@ public sealed class BaseItemRepository } var typeToSerialise = GetType(baseItemEntity.Type); - return BaseItemRepository.DeserialiseBaseItem( + return BaseItemRepository.DeserializeBaseItem( baseItemEntity, _logger, _appHost, @@ -882,7 +1055,7 @@ public sealed class BaseItemRepository } /// <summary> - /// Deserialises a BaseItemEntity and sets all properties. + /// Deserializes a BaseItemEntity and sets all properties. /// </summary> /// <param name="baseItemEntity">The DB entity.</param> /// <param name="logger">Logger.</param> @@ -890,9 +1063,9 @@ public sealed class BaseItemRepository /// <param name="skipDeserialization">If only mapping should be processed.</param> /// <returns>A mapped BaseItem.</returns> /// <exception cref="InvalidOperationException">Will be thrown if an invalid serialisation is requested.</exception> - public static BaseItemDto DeserialiseBaseItem(BaseItemEntity baseItemEntity, ILogger logger, IServerApplicationHost? appHost, bool skipDeserialization = false) + public static BaseItemDto DeserializeBaseItem(BaseItemEntity baseItemEntity, ILogger logger, IServerApplicationHost? appHost, bool skipDeserialization = false) { - var type = GetType(baseItemEntity.Type) ?? throw new InvalidOperationException("Cannot deserialise unknown type."); + var type = GetType(baseItemEntity.Type) ?? throw new InvalidOperationException("Cannot deserialize unknown type."); BaseItemDto? dto = null; if (TypeRequiresDeserialization(type) && baseItemEntity.Data is not null && !skipDeserialization) { @@ -908,13 +1081,13 @@ public sealed class BaseItemRepository if (dto is null) { - dto = Activator.CreateInstance(type) as BaseItemDto ?? throw new InvalidOperationException("Cannot deserialise unknown type."); + dto = Activator.CreateInstance(type) as BaseItemDto ?? throw new InvalidOperationException("Cannot deserialize unknown type."); } return Map(baseItemEntity, dto, appHost); } - private QueryResult<(BaseItemDto Item, ItemCounts ItemCounts)> GetItemValues(InternalItemsQuery filter, IReadOnlyList<ItemValueType> itemValueTypes, string returnType) + private QueryResult<(BaseItemDto Item, ItemCounts? ItemCounts)> GetItemValues(InternalItemsQuery filter, IReadOnlyList<ItemValueType> itemValueTypes, string returnType) { ArgumentNullException.ThrowIfNull(filter); @@ -925,7 +1098,7 @@ public sealed class BaseItemRepository using var context = _dbProvider.CreateDbContext(); - var innerQuery = new InternalItemsQuery(filter.User) + var innerQueryFilter = TranslateQuery(context.BaseItems.Where(e => e.Id != EF.Constant(PlaceholderId)), context, new InternalItemsQuery(filter.User) { ExcludeItemTypes = filter.ExcludeItemTypes, IncludeItemTypes = filter.IncludeItemTypes, @@ -940,19 +1113,44 @@ public sealed class BaseItemRepository IsKids = filter.IsKids, IsNews = filter.IsNews, IsSeries = filter.IsSeries + }); + + var innerQuery = PrepareItemQuery(context, filter) + .Where(e => e.Type == returnType) + .Where(e => context.ItemValues! + .Where(f => itemValueTypes.Contains(f.Type)) + .Where(f => innerQueryFilter.Any(g => f.BaseItemsMap!.Any(w => w.ItemId == g.Id))) + .Select(f => f.CleanValue) + .Contains(e.CleanName)); + + var outerQueryFilter = new InternalItemsQuery(filter.User) + { + IsPlayed = filter.IsPlayed, + IsFavorite = filter.IsFavorite, + IsFavoriteOrLiked = filter.IsFavoriteOrLiked, + IsLiked = filter.IsLiked, + IsLocked = filter.IsLocked, + NameLessThan = filter.NameLessThan, + NameStartsWith = filter.NameStartsWith, + NameStartsWithOrGreater = filter.NameStartsWithOrGreater, + Tags = filter.Tags, + OfficialRatings = filter.OfficialRatings, + StudioIds = filter.StudioIds, + GenreIds = filter.GenreIds, + Genres = filter.Genres, + Years = filter.Years, + NameContains = filter.NameContains, + SearchTerm = filter.SearchTerm, + ExcludeItemIds = filter.ExcludeItemIds }; - var query = TranslateQuery(context.BaseItems.AsNoTracking(), context, innerQuery); - query = query.Where(e => e.Type == returnType && e.ItemValues!.Any(f => e.CleanName == f.ItemValue.CleanValue && itemValueTypes.Any(w => (ItemValueType)w == f.ItemValue.Type))); + var query = TranslateQuery(innerQuery, context, outerQueryFilter) + .GroupBy(e => e.PresentationUniqueKey); - if (filter.OrderBy.Count != 0 - || !string.IsNullOrEmpty(filter.SearchTerm)) - { - query = ApplyOrder(query, filter); - } - else + var result = new QueryResult<(BaseItemDto, ItemCounts?)>(); + if (filter.EnableTotalRecordCount) { - query = query.OrderBy(e => e.SortName); + result.TotalRecordCount = query.Count(); } if (filter.Limit.HasValue || filter.StartIndex.HasValue) @@ -970,41 +1168,84 @@ public sealed class BaseItemRepository } } - var result = new QueryResult<(BaseItemDto, ItemCounts)>(); - if (filter.EnableTotalRecordCount) - { - result.TotalRecordCount = query.GroupBy(e => e.PresentationUniqueKey).Select(e => e.First()).Count(); - } + IQueryable<BaseItemEntity>? itemCountQuery = null; - var seriesTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Series]; - var movieTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Movie]; - var episodeTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Episode]; - var musicAlbumTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicAlbum]; - var musicArtistTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicArtist]; - var audioTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Audio]; - var trailerTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Trailer]; - - var resultQuery = query.Select(e => new + if (filter.IncludeItemTypes.Length > 0) { - item = e, - // TODO: This is bad refactor! - itemCount = new ItemCounts() + // if we are to include more then one type, sub query those items beforehand. + + var typeSubQuery = new InternalItemsQuery(filter.User) { - SeriesCount = e.ItemValues!.Count(f => f.Item.Type == seriesTypeName), - EpisodeCount = e.ItemValues!.Count(f => f.Item.Type == episodeTypeName), - MovieCount = e.ItemValues!.Count(f => f.Item.Type == movieTypeName), - AlbumCount = e.ItemValues!.Count(f => f.Item.Type == musicAlbumTypeName), - ArtistCount = e.ItemValues!.Count(f => f.Item.Type == musicArtistTypeName), - SongCount = e.ItemValues!.Count(f => f.Item.Type == audioTypeName), - TrailerCount = e.ItemValues!.Count(f => f.Item.Type == trailerTypeName), - } - }); + ExcludeItemTypes = filter.ExcludeItemTypes, + IncludeItemTypes = filter.IncludeItemTypes, + MediaTypes = filter.MediaTypes, + AncestorIds = filter.AncestorIds, + ExcludeItemIds = filter.ExcludeItemIds, + ItemIds = filter.ItemIds, + TopParentIds = filter.TopParentIds, + ParentId = filter.ParentId, + IsPlayed = filter.IsPlayed + }; - result.StartIndex = filter.StartIndex ?? 0; - result.Items = resultQuery.ToArray().Where(e => e is not null).Select(e => + itemCountQuery = TranslateQuery(context.BaseItems.AsNoTracking().Where(e => e.Id != EF.Constant(PlaceholderId)), context, typeSubQuery) + .Where(e => e.ItemValues!.Any(f => itemValueTypes!.Contains(f.ItemValue.Type))); + + var seriesTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Series]; + var movieTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Movie]; + var episodeTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Episode]; + var musicAlbumTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicAlbum]; + var musicArtistTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicArtist]; + var audioTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Audio]; + var trailerTypeName = _itemTypeLookup.BaseItemKindNames[BaseItemKind.Trailer]; + + var resultQuery = query.Select(e => new + { + item = e.AsQueryable() + .Include(e => e.TrailerTypes) + .Include(e => e.Provider) + .Include(e => e.LockedFields) + .Include(e => e.Images) + .AsSingleQuery().First(), + // TODO: This is bad refactor! + itemCount = new ItemCounts() + { + SeriesCount = itemCountQuery!.Count(f => f.Type == seriesTypeName), + EpisodeCount = itemCountQuery!.Count(f => f.Type == episodeTypeName), + MovieCount = itemCountQuery!.Count(f => f.Type == movieTypeName), + AlbumCount = itemCountQuery!.Count(f => f.Type == musicAlbumTypeName), + ArtistCount = itemCountQuery!.Count(f => f.Type == musicArtistTypeName), + SongCount = itemCountQuery!.Count(f => f.Type == audioTypeName), + TrailerCount = itemCountQuery!.Count(f => f.Type == trailerTypeName), + } + }); + + result.StartIndex = filter.StartIndex ?? 0; + result.Items = + [ + .. resultQuery + .AsEnumerable() + .Where(e => e is not null) + .Select(e => + { + return (DeserializeBaseItem(e.item, filter.SkipDeserialization), e.itemCount); + }) + ]; + } + else { - return (DeserialiseBaseItem(e.item, filter.SkipDeserialization), e.itemCount); - }).ToArray(); + result.StartIndex = filter.StartIndex ?? 0; + result.Items = + [ + .. query + .Select(e => e.First()) + .AsEnumerable() + .Where(e => e is not null) + .Select<BaseItemEntity, (BaseItemDto, ItemCounts?)>(e => + { + return (DeserializeBaseItem(e, filter.SkipDeserialization), null); + }) + ]; + } return result; } @@ -1032,27 +1273,27 @@ public sealed class BaseItemRepository return value.RemoveDiacritics().ToLowerInvariant(); } - private List<(int MagicNumber, string Value)> GetItemValuesToSave(BaseItemDto item, List<string> inheritedTags) + private List<(ItemValueType MagicNumber, string Value)> GetItemValuesToSave(BaseItemDto item, List<string> inheritedTags) { - var list = new List<(int, string)>(); + var list = new List<(ItemValueType, string)>(); if (item is IHasArtist hasArtist) { - list.AddRange(hasArtist.Artists.Select(i => (0, i))); + list.AddRange(hasArtist.Artists.Select(i => ((ItemValueType)0, i))); } if (item is IHasAlbumArtist hasAlbumArtist) { - list.AddRange(hasAlbumArtist.AlbumArtists.Select(i => (1, i))); + list.AddRange(hasAlbumArtist.AlbumArtists.Select(i => (ItemValueType.AlbumArtist, i))); } - list.AddRange(item.Genres.Select(i => (2, i))); - list.AddRange(item.Studios.Select(i => (3, i))); - list.AddRange(item.Tags.Select(i => (4, i))); + list.AddRange(item.Genres.Select(i => (ItemValueType.Genre, i))); + list.AddRange(item.Studios.Select(i => (ItemValueType.Studios, i))); + list.AddRange(item.Tags.Select(i => (ItemValueType.Tags, i))); // keywords was 5 - list.AddRange(inheritedTags.Select(i => (6, i))); + list.AddRange(inheritedTags.Select(i => (ItemValueType.InheritedTags, i))); // Remove all invalid values. list.RemoveAll(i => string.IsNullOrWhiteSpace(i.Item2)); @@ -1082,7 +1323,7 @@ public sealed class BaseItemRepository { Path = appHost?.ExpandVirtualPath(e.Path) ?? e.Path, BlurHash = e.Blurhash is null ? null : Encoding.UTF8.GetString(e.Blurhash), - DateModified = e.DateModified, + DateModified = e.DateModified ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc), Height = e.Height, Width = e.Width, Type = (ImageType)e.ImageType @@ -1141,45 +1382,6 @@ public sealed class BaseItemRepository return query.IncludeItemTypes.Length == 0 || query.IncludeItemTypes.Contains(type); } - private Expression<Func<BaseItemEntity, object>> MapOrderByField(ItemSortBy sortBy, InternalItemsQuery query) - { -#pragma warning disable CS8603 // Possible null reference return. - return sortBy switch - { - ItemSortBy.AirTime => e => e.SortName, // TODO - ItemSortBy.Runtime => e => e.RunTimeTicks, - ItemSortBy.Random => e => EF.Functions.Random(), - ItemSortBy.DatePlayed => e => e.UserData!.FirstOrDefault(f => f.UserId == query.User!.Id)!.LastPlayedDate, - ItemSortBy.PlayCount => e => e.UserData!.FirstOrDefault(f => f.UserId == query.User!.Id)!.PlayCount, - ItemSortBy.IsFavoriteOrLiked => e => e.UserData!.FirstOrDefault(f => f.UserId == query.User!.Id)!.IsFavorite, - ItemSortBy.IsFolder => e => e.IsFolder, - ItemSortBy.IsPlayed => e => e.UserData!.FirstOrDefault(f => f.UserId == query.User!.Id)!.Played, - ItemSortBy.IsUnplayed => e => !e.UserData!.FirstOrDefault(f => f.UserId == query.User!.Id)!.Played, - ItemSortBy.DateLastContentAdded => e => e.DateLastMediaAdded, - ItemSortBy.Artist => e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.Artist).Select(f => f.ItemValue.CleanValue).FirstOrDefault(), - ItemSortBy.AlbumArtist => e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.AlbumArtist).Select(f => f.ItemValue.CleanValue).FirstOrDefault(), - ItemSortBy.Studio => e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.Studios).Select(f => f.ItemValue.CleanValue).FirstOrDefault(), - ItemSortBy.OfficialRating => e => e.InheritedParentalRatingValue, - // ItemSortBy.SeriesDatePlayed => "(Select MAX(LastPlayedDate) from TypedBaseItems B" + GetJoinUserDataText(query) + " where Played=1 and B.SeriesPresentationUniqueKey=A.PresentationUniqueKey)", - ItemSortBy.SeriesSortName => e => e.SeriesName, - // ItemSortBy.AiredEpisodeOrder => "AiredEpisodeOrder", - ItemSortBy.Album => e => e.Album, - ItemSortBy.DateCreated => e => e.DateCreated, - ItemSortBy.PremiereDate => e => e.PremiereDate, - ItemSortBy.StartDate => e => e.StartDate, - ItemSortBy.Name => e => e.Name, - ItemSortBy.CommunityRating => e => e.CommunityRating, - ItemSortBy.ProductionYear => e => e.ProductionYear, - ItemSortBy.CriticRating => e => e.CriticRating, - ItemSortBy.VideoBitRate => e => e.TotalBitrate, - ItemSortBy.ParentIndexNumber => e => e.ParentIndexNumber, - ItemSortBy.IndexNumber => e => e.IndexNumber, - _ => e => e.SortName - }; -#pragma warning restore CS8603 // Possible null reference return. - - } - private bool EnableGroupByPresentationUniqueKey(InternalItemsQuery query) { if (!query.GroupByPresentationUniqueKey) @@ -1226,7 +1428,7 @@ public sealed class BaseItemRepository } else if (orderBy.Count == 0) { - return query; + return query.OrderBy(e => e.SortName); } IOrderedQueryable<BaseItemEntity>? orderedQuery = null; @@ -1234,7 +1436,7 @@ public sealed class BaseItemRepository var firstOrdering = orderBy.FirstOrDefault(); if (firstOrdering != default) { - var expression = MapOrderByField(firstOrdering.OrderBy, filter); + var expression = OrderMapper.MapOrderByField(firstOrdering.OrderBy, filter); if (firstOrdering.SortOrder == SortOrder.Ascending) { orderedQuery = query.OrderBy(expression); @@ -1259,7 +1461,7 @@ public sealed class BaseItemRepository foreach (var item in orderBy.Skip(1)) { - var expression = MapOrderByField(item.OrderBy, filter); + var expression = OrderMapper.MapOrderByField(item.OrderBy, filter); if (item.SortOrder == SortOrder.Ascending) { orderedQuery = orderedQuery!.ThenBy(expression); @@ -1278,34 +1480,39 @@ public sealed class BaseItemRepository JellyfinDbContext context, InternalItemsQuery filter) { + const int HDWidth = 1200; + const int UHDWidth = 3800; + const int UHDHeight = 2100; + var minWidth = filter.MinWidth; var maxWidth = filter.MaxWidth; var now = DateTime.UtcNow; - if (filter.IsHD.HasValue) + if (filter.IsHD.HasValue || filter.Is4K.HasValue) { - const int Threshold = 1200; - if (filter.IsHD.Value) - { - minWidth = Threshold; - } - else + bool includeSD = false; + bool includeHD = false; + bool include4K = false; + + if (filter.IsHD.HasValue && !filter.IsHD.Value) { - maxWidth = Threshold - 1; + includeSD = true; } - } - if (filter.Is4K.HasValue) - { - const int Threshold = 3800; - if (filter.Is4K.Value) + if (filter.IsHD.HasValue && filter.IsHD.Value) { - minWidth = Threshold; + includeHD = true; } - else + + if (filter.Is4K.HasValue && filter.Is4K.Value) { - maxWidth = Threshold - 1; + include4K = true; } + + baseQuery = baseQuery.Where(e => + (includeSD && e.Width < HDWidth) || + (includeHD && e.Width >= HDWidth && !(e.Width >= UHDWidth || e.Height >= UHDHeight)) || + (include4K && (e.Width >= UHDWidth || e.Height >= UHDHeight))); } if (minWidth.HasValue) @@ -1320,7 +1527,7 @@ public sealed class BaseItemRepository if (maxWidth.HasValue) { - baseQuery = baseQuery.Where(e => e.Width >= maxWidth); + baseQuery = baseQuery.Where(e => e.Width <= maxWidth); } if (filter.MaxHeight.HasValue) @@ -1403,6 +1610,7 @@ public sealed class BaseItemRepository } var includeTypes = filter.IncludeItemTypes; + // Only specify excluded types if no included types are specified if (filter.IncludeItemTypes.Length == 0) { @@ -1428,25 +1636,10 @@ public sealed class BaseItemRepository baseQuery = baseQuery.Where(e => !excludeTypeName.Contains(e.Type)); } } - else if (includeTypes.Length == 1) - { - if (_itemTypeLookup.BaseItemKindNames.TryGetValue(includeTypes[0], out var includeTypeName)) - { - baseQuery = baseQuery.Where(e => e.Type == includeTypeName); - } - } - else if (includeTypes.Length > 1) + else { - var includeTypeName = new List<string>(); - foreach (var includeType in includeTypes) - { - if (_itemTypeLookup.BaseItemKindNames.TryGetValue(includeType, out var baseItemKindName)) - { - includeTypeName.Add(baseItemKindName!); - } - } - - baseQuery = baseQuery.Where(e => includeTypeName.Contains(e.Type)); + string[] types = includeTypes.Select(f => _itemTypeLookup.BaseItemKindNames.GetValueOrDefault(f)).Where(e => e != null).ToArray()!; + baseQuery = baseQuery.WhereOneOrMany(types, f => f.Type); } if (filter.ChannelIds.Count > 0) @@ -1552,7 +1745,7 @@ public sealed class BaseItemRepository if (filter.MinPremiereDate.HasValue) { - baseQuery = baseQuery.Where(e => e.PremiereDate <= filter.MinPremiereDate.Value); + baseQuery = baseQuery.Where(e => e.PremiereDate >= filter.MinPremiereDate.Value); } if (filter.MaxPremiereDate.HasValue) @@ -1670,7 +1863,7 @@ public sealed class BaseItemRepository // We should probably figure this out for all folders, but for right now, this is the only place where we need it if (filter.IncludeItemTypes.Length == 1 && filter.IncludeItemTypes[0] == BaseItemKind.Series) { - baseQuery = baseQuery.Where(e => context.BaseItems + baseQuery = baseQuery.Where(e => context.BaseItems.Where(e => e.Id != EF.Constant(PlaceholderId)) .Where(e => e.IsFolder == false && e.IsVirtualItem == false) .Where(f => f.UserData!.FirstOrDefault(e => e.UserId == filter.User!.Id && e.Played)!.Played) .Any(f => f.SeriesPresentationUniqueKey == e.PresentationUniqueKey) == filter.IsPlayed); @@ -1704,64 +1897,59 @@ public sealed class BaseItemRepository if (filter.ArtistIds.Length > 0) { - baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type <= ItemValueType.Artist && filter.ArtistIds.Contains(f.ItemId))); + baseQuery = baseQuery.WhereReferencedItem(context, ItemValueType.Artist, filter.ArtistIds); } if (filter.AlbumArtistIds.Length > 0) { - baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Artist && filter.AlbumArtistIds.Contains(f.ItemId))); + baseQuery = baseQuery.WhereReferencedItem(context, ItemValueType.Artist, filter.AlbumArtistIds); } if (filter.ContributingArtistIds.Length > 0) { - baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Artist && filter.ContributingArtistIds.Contains(f.ItemId))); + baseQuery = baseQuery.WhereReferencedItem(context, ItemValueType.Artist, filter.ContributingArtistIds); } if (filter.AlbumIds.Length > 0) { - baseQuery = baseQuery.Where(e => context.BaseItems.Where(f => filter.AlbumIds.Contains(f.Id)).Any(f => f.Name == e.Album)); + var subQuery = context.BaseItems.WhereOneOrMany(filter.AlbumIds, f => f.Id); + baseQuery = baseQuery.Where(e => subQuery.Any(f => f.Name == e.Album)); } if (filter.ExcludeArtistIds.Length > 0) { - baseQuery = baseQuery - .Where(e => !e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Artist && filter.ExcludeArtistIds.Contains(f.ItemId))); + baseQuery = baseQuery.WhereReferencedItem(context, ItemValueType.Artist, filter.ExcludeArtistIds, true); } if (filter.GenreIds.Count > 0) { - baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Genre && filter.GenreIds.Contains(f.ItemId))); + baseQuery = baseQuery.WhereReferencedItem(context, ItemValueType.Genre, filter.GenreIds.ToArray()); } if (filter.Genres.Count > 0) { - var cleanGenres = filter.Genres.Select(e => GetCleanValue(e)).ToArray(); + var cleanGenres = filter.Genres.Select(e => GetCleanValue(e)).ToArray().OneOrManyExpressionBuilder<ItemValueMap, string>(f => f.ItemValue.CleanValue); baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Genre && cleanGenres.Contains(f.ItemValue.CleanValue))); + .Where(e => e.ItemValues!.AsQueryable().Where(f => f.ItemValue.Type == ItemValueType.Genre).Any(cleanGenres)); } if (tags.Count > 0) { - var cleanValues = tags.Select(e => GetCleanValue(e)).ToArray(); + var cleanValues = tags.Select(e => GetCleanValue(e)).ToArray().OneOrManyExpressionBuilder<ItemValueMap, string>(f => f.ItemValue.CleanValue); baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Tags && cleanValues.Contains(f.ItemValue.CleanValue))); + .Where(e => e.ItemValues!.AsQueryable().Where(f => f.ItemValue.Type == ItemValueType.Tags).Any(cleanValues)); } if (excludeTags.Count > 0) { - var cleanValues = excludeTags.Select(e => GetCleanValue(e)).ToArray(); + var cleanValues = excludeTags.Select(e => GetCleanValue(e)).ToArray().OneOrManyExpressionBuilder<ItemValueMap, string>(f => f.ItemValue.CleanValue); baseQuery = baseQuery - .Where(e => !e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Tags && cleanValues.Contains(f.ItemValue.CleanValue))); + .Where(e => !e.ItemValues!.AsQueryable().Where(f => f.ItemValue.Type == ItemValueType.Tags).Any(cleanValues)); } if (filter.StudioIds.Length > 0) { - baseQuery = baseQuery - .Where(e => e.ItemValues!.Any(f => f.ItemValue.Type == ItemValueType.Studios && filter.StudioIds.Contains(f.ItemId))); + baseQuery = baseQuery.WhereReferencedItem(context, ItemValueType.Studios, filter.StudioIds.ToArray()); } if (filter.OfficialRatings.Length > 0) @@ -1770,61 +1958,73 @@ public sealed class BaseItemRepository .Where(e => filter.OfficialRatings.Contains(e.OfficialRating)); } - if (filter.HasParentalRating ?? false) + Expression<Func<BaseItemEntity, bool>>? minParentalRatingFilter = null; + if (filter.MinParentalRating != null) { - if (filter.MinParentalRating.HasValue) + var min = filter.MinParentalRating; + minParentalRatingFilter = e => e.InheritedParentalRatingValue >= min.Score || e.InheritedParentalRatingValue == null; + if (min.SubScore != null) { - baseQuery = baseQuery - .Where(e => e.InheritedParentalRatingValue >= filter.MinParentalRating.Value); + minParentalRatingFilter = minParentalRatingFilter.And(e => e.InheritedParentalRatingValue >= min.SubScore || e.InheritedParentalRatingValue == null); } + } - if (filter.MaxParentalRating.HasValue) + Expression<Func<BaseItemEntity, bool>>? maxParentalRatingFilter = null; + if (filter.MaxParentalRating != null) + { + var max = filter.MaxParentalRating; + maxParentalRatingFilter = e => e.InheritedParentalRatingValue <= max.Score || e.InheritedParentalRatingValue == null; + if (max.SubScore != null) { - baseQuery = baseQuery - .Where(e => e.InheritedParentalRatingValue < filter.MaxParentalRating.Value); + maxParentalRatingFilter = maxParentalRatingFilter.And(e => e.InheritedParentalRatingValue <= max.SubScore || e.InheritedParentalRatingValue == null); } } - else if (filter.BlockUnratedItems.Length > 0) + + if (filter.HasParentalRating ?? false) { - var unratedItems = filter.BlockUnratedItems.Select(f => f.ToString()).ToArray(); - if (filter.MinParentalRating.HasValue) + if (minParentalRatingFilter != null) { - if (filter.MaxParentalRating.HasValue) - { - baseQuery = baseQuery - .Where(e => (e.InheritedParentalRatingValue == null && !unratedItems.Contains(e.UnratedType)) - || (e.InheritedParentalRatingValue >= filter.MinParentalRating && e.InheritedParentalRatingValue <= filter.MaxParentalRating)); - } - else - { - baseQuery = baseQuery - .Where(e => (e.InheritedParentalRatingValue == null && !unratedItems.Contains(e.UnratedType)) - || e.InheritedParentalRatingValue >= filter.MinParentalRating); - } + baseQuery = baseQuery.Where(minParentalRatingFilter); } - else + + if (maxParentalRatingFilter != null) { - baseQuery = baseQuery - .Where(e => e.InheritedParentalRatingValue != null && !unratedItems.Contains(e.UnratedType)); + baseQuery = baseQuery.Where(maxParentalRatingFilter); } } - else if (filter.MinParentalRating.HasValue) + else if (filter.BlockUnratedItems.Length > 0) { - if (filter.MaxParentalRating.HasValue) + var unratedItemTypes = filter.BlockUnratedItems.Select(f => f.ToString()).ToArray(); + Expression<Func<BaseItemEntity, bool>> unratedItemFilter = e => e.InheritedParentalRatingValue != null || !unratedItemTypes.Contains(e.UnratedType); + + if (minParentalRatingFilter != null && maxParentalRatingFilter != null) { - baseQuery = baseQuery - .Where(e => e.InheritedParentalRatingValue != null && e.InheritedParentalRatingValue >= filter.MinParentalRating.Value && e.InheritedParentalRatingValue <= filter.MaxParentalRating.Value); + baseQuery = baseQuery.Where(unratedItemFilter.And(minParentalRatingFilter.And(maxParentalRatingFilter))); + } + else if (minParentalRatingFilter != null) + { + baseQuery = baseQuery.Where(unratedItemFilter.And(minParentalRatingFilter)); + } + else if (maxParentalRatingFilter != null) + { + baseQuery = baseQuery.Where(unratedItemFilter.And(maxParentalRatingFilter)); } else { - baseQuery = baseQuery - .Where(e => e.InheritedParentalRatingValue != null && e.InheritedParentalRatingValue >= filter.MinParentalRating.Value); + baseQuery = baseQuery.Where(unratedItemFilter); } } - else if (filter.MaxParentalRating.HasValue) + else if (minParentalRatingFilter != null || maxParentalRatingFilter != null) { - baseQuery = baseQuery - .Where(e => e.InheritedParentalRatingValue != null && e.InheritedParentalRatingValue >= filter.MaxParentalRating.Value); + if (minParentalRatingFilter != null) + { + baseQuery = baseQuery.Where(minParentalRatingFilter); + } + + if (maxParentalRatingFilter != null) + { + baseQuery = baseQuery.Where(maxParentalRatingFilter); + } } else if (!filter.HasParentalRating ?? false) { @@ -1913,36 +2113,36 @@ public sealed class BaseItemRepository if (filter.HasDeadParentId.HasValue && filter.HasDeadParentId.Value) { baseQuery = baseQuery - .Where(e => e.ParentId.HasValue && !context.BaseItems.Any(f => f.Id == e.ParentId.Value)); + .Where(e => e.ParentId.HasValue && !context.BaseItems.Where(e => e.Id != EF.Constant(PlaceholderId)).Any(f => f.Id == e.ParentId.Value)); } if (filter.IsDeadArtist.HasValue && filter.IsDeadArtist.Value) { baseQuery = baseQuery - .Where(e => e.ItemValues!.Count(f => f.ItemValue.Type == ItemValueType.Artist || f.ItemValue.Type == ItemValueType.AlbumArtist) == 1); + .Where(e => !context.ItemValues.Where(f => _getAllArtistsValueTypes.Contains(f.Type)).Any(f => f.Value == e.Name)); } if (filter.IsDeadStudio.HasValue && filter.IsDeadStudio.Value) { baseQuery = baseQuery - .Where(e => e.ItemValues!.Count(f => f.ItemValue.Type == ItemValueType.Studios) == 1); + .Where(e => !context.ItemValues.Where(f => _getStudiosValueTypes.Contains(f.Type)).Any(f => f.Value == e.Name)); } - if (filter.IsDeadPerson.HasValue && filter.IsDeadPerson.Value) + if (filter.IsDeadGenre.HasValue && filter.IsDeadGenre.Value) { baseQuery = baseQuery - .Where(e => !context.Peoples.Any(f => f.Name == e.Name)); + .Where(e => !context.ItemValues.Where(f => _getGenreValueTypes.Contains(f.Type)).Any(f => f.Value == e.Name)); } - if (filter.Years.Length == 1) + if (filter.IsDeadPerson.HasValue && filter.IsDeadPerson.Value) { baseQuery = baseQuery - .Where(e => e.ProductionYear == filter.Years[0]); + .Where(e => !context.Peoples.Any(f => f.Name == e.Name)); } - else if (filter.Years.Length > 1) + + if (filter.Years.Length > 0) { - baseQuery = baseQuery - .Where(e => filter.Years.Any(f => f == e.ProductionYear)); + baseQuery = baseQuery.WhereOneOrMany(filter.Years, e => e.ProductionYear!.Value); } var isVirtualItem = filter.IsVirtualItem ?? filter.IsMissing; @@ -1983,30 +2183,30 @@ public sealed class BaseItemRepository if (filter.MediaTypes.Length > 0) { var mediaTypes = filter.MediaTypes.Select(f => f.ToString()).ToArray(); - baseQuery = baseQuery - .Where(e => mediaTypes.Contains(e.MediaType)); + baseQuery = baseQuery.WhereOneOrMany(mediaTypes, e => e.MediaType); } if (filter.ItemIds.Length > 0) { - baseQuery = baseQuery - .Where(e => filter.ItemIds.Contains(e.Id)); + baseQuery = baseQuery.WhereOneOrMany(filter.ItemIds, e => e.Id); } if (filter.ExcludeItemIds.Length > 0) { baseQuery = baseQuery - .Where(e => !filter.ItemIds.Contains(e.Id)); + .Where(e => !filter.ExcludeItemIds.Contains(e.Id)); } if (filter.ExcludeProviderIds is not null && filter.ExcludeProviderIds.Count > 0) { - baseQuery = baseQuery.Where(e => !e.Provider!.All(f => !filter.ExcludeProviderIds.All(w => f.ProviderId == w.Key && f.ProviderValue == w.Value))); + var exclude = filter.ExcludeProviderIds.Select(e => $"{e.Key}:{e.Value}").ToArray(); + baseQuery = baseQuery.Where(e => e.Provider!.Select(f => f.ProviderId + ":" + f.ProviderValue)!.All(f => !exclude.Contains(f))); } if (filter.HasAnyProviderId is not null && filter.HasAnyProviderId.Count > 0) { - baseQuery = baseQuery.Where(e => e.Provider!.Any(f => !filter.HasAnyProviderId.Any(w => f.ProviderId == w.Key && f.ProviderValue == w.Value))); + var include = filter.HasAnyProviderId.Select(e => $"{e.Key}:{e.Value}").ToArray(); + baseQuery = baseQuery.Where(e => e.Provider!.Select(f => f.ProviderId + ":" + f.ProviderValue)!.Any(f => include.Contains(f))); } if (filter.HasImdbId.HasValue) @@ -2036,19 +2236,19 @@ public sealed class BaseItemRepository } else { - baseQuery = baseQuery.Where(e => queryTopParentIds.Contains(e.TopParentId!.Value)); + baseQuery = baseQuery.WhereOneOrMany(queryTopParentIds, e => e.TopParentId!.Value); } } if (filter.AncestorIds.Length > 0) { - baseQuery = baseQuery.Where(e => e.Children!.Any(f => filter.AncestorIds.Contains(f.ParentItemId))); + baseQuery = baseQuery.Where(e => e.Parents!.Any(f => filter.AncestorIds.Contains(f.ParentItemId))); } if (!string.IsNullOrWhiteSpace(filter.AncestorWithPresentationUniqueKey)) { baseQuery = baseQuery - .Where(e => context.BaseItems.Where(f => f.PresentationUniqueKey == filter.AncestorWithPresentationUniqueKey).Any(f => f.ParentAncestors!.Any(w => w.ItemId == f.Id))); + .Where(e => context.BaseItems.Where(e => e.Id != EF.Constant(PlaceholderId)).Where(f => f.PresentationUniqueKey == filter.AncestorWithPresentationUniqueKey).Any(f => f.Children!.Any(w => w.ItemId == e.Id))); } if (!string.IsNullOrWhiteSpace(filter.SeriesPresentationUniqueKey)) @@ -2060,8 +2260,8 @@ public sealed class BaseItemRepository if (filter.ExcludeInheritedTags.Length > 0) { baseQuery = baseQuery - .Where(e => !e.ItemValues!.Where(w => w.ItemValue.Type == ItemValueType.InheritedTags) - .Any(f => filter.ExcludeInheritedTags.Contains(f.ItemValue.CleanValue))); + .Where(e => !e.ItemValues!.Where(w => w.ItemValue.Type == ItemValueType.InheritedTags || w.ItemValue.Type == ItemValueType.Tags) + .Any(f => filter.ExcludeInheritedTags.Contains(f.ItemValue.CleanValue))); } if (filter.IncludeInheritedTags.Length > 0) @@ -2071,10 +2271,10 @@ public sealed class BaseItemRepository if (includeTypes.Length == 1 && includeTypes.FirstOrDefault() is BaseItemKind.Episode) { baseQuery = baseQuery - .Where(e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.InheritedTags) + .Where(e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.InheritedTags || f.ItemValue.Type == ItemValueType.Tags) .Any(f => filter.IncludeInheritedTags.Contains(f.ItemValue.CleanValue)) || - (e.ParentId.HasValue && context.ItemValuesMap.Where(w => w.ItemId == e.ParentId.Value)!.Where(w => w.ItemValue.Type == ItemValueType.InheritedTags) + (e.ParentId.HasValue && context.ItemValuesMap.Where(w => w.ItemId == e.ParentId.Value && (w.ItemValue.Type == ItemValueType.InheritedTags || w.ItemValue.Type == ItemValueType.Tags)) .Any(f => filter.IncludeInheritedTags.Contains(f.ItemValue.CleanValue)))); } @@ -2082,17 +2282,16 @@ public sealed class BaseItemRepository else if (includeTypes.Length == 1 && includeTypes.FirstOrDefault() is BaseItemKind.Playlist) { baseQuery = baseQuery - .Where(e => - e.ParentAncestors! - .Any(f => - f.ParentItem.ItemValues!.Any(w => w.ItemValue.Type == ItemValueType.Tags && filter.IncludeInheritedTags.Contains(w.ItemValue.CleanValue)) - || e.Data!.Contains($"OwnerUserId\":\"{filter.User!.Id:N}\""))); + .Where(e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.InheritedTags || f.ItemValue.Type == ItemValueType.Tags) + .Any(f => filter.IncludeInheritedTags.Contains(f.ItemValue.CleanValue)) + || e.Data!.Contains($"OwnerUserId\":\"{filter.User!.Id:N}\"")); // d ^^ this is stupid it hate this. } else { baseQuery = baseQuery - .Where(e => e.ParentAncestors!.Any(f => f.ParentItem.ItemValues!.Any(w => w.ItemValue.Type == ItemValueType.Tags && filter.IncludeInheritedTags.Contains(w.ItemValue.CleanValue)))); + .Where(e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.InheritedTags || f.ItemValue.Type == ItemValueType.Tags) + .Any(f => filter.IncludeInheritedTags.Contains(f.ItemValue.CleanValue))); } } @@ -2175,4 +2374,14 @@ public sealed class BaseItemRepository return baseQuery; } + + /// <inheritdoc/> + public async Task<bool> ItemExistsAsync(Guid id) + { + var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); + await using (dbContext.ConfigureAwait(false)) + { + return await dbContext.BaseItems.AnyAsync(f => f.Id == id).ConfigureAwait(false); + } + } } diff --git a/Jellyfin.Server.Implementations/Item/ChapterRepository.cs b/Jellyfin.Server.Implementations/Item/ChapterRepository.cs index fc6f04d56..e0d23a261 100644 --- a/Jellyfin.Server.Implementations/Item/ChapterRepository.cs +++ b/Jellyfin.Server.Implementations/Item/ChapterRepository.cs @@ -1,11 +1,10 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.Linq; -using Jellyfin.Data.Entities; -using MediaBrowser.Controller.Chapters; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Drawing; -using MediaBrowser.Model.Dto; +using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using Microsoft.EntityFrameworkCore; @@ -30,19 +29,7 @@ public class ChapterRepository : IChapterRepository _imageProcessor = imageProcessor; } - /// <inheritdoc cref="IChapterRepository"/> - public ChapterInfo? GetChapter(BaseItemDto baseItem, int index) - { - return GetChapter(baseItem.Id, index); - } - - /// <inheritdoc cref="IChapterRepository"/> - public IReadOnlyList<ChapterInfo> GetChapters(BaseItemDto baseItem) - { - return GetChapters(baseItem.Id); - } - - /// <inheritdoc cref="IChapterRepository"/> + /// <inheritdoc /> public ChapterInfo? GetChapter(Guid baseItemId, int index) { using var context = _dbProvider.CreateDbContext(); @@ -61,7 +48,7 @@ public class ChapterRepository : IChapterRepository return null; } - /// <inheritdoc cref="IChapterRepository"/> + /// <inheritdoc /> public IReadOnlyList<ChapterInfo> GetChapters(Guid baseItemId) { using var context = _dbProvider.CreateDbContext(); @@ -76,7 +63,7 @@ public class ChapterRepository : IChapterRepository .ToArray(); } - /// <inheritdoc cref="IChapterRepository"/> + /// <inheritdoc /> public void SaveChapters(Guid itemId, IReadOnlyList<ChapterInfo> chapters) { using var context = _dbProvider.CreateDbContext(); @@ -94,6 +81,14 @@ public class ChapterRepository : IChapterRepository } } + /// <inheritdoc /> + public void DeleteChapters(Guid itemId) + { + using var context = _dbProvider.CreateDbContext(); + context.Chapters.Where(c => c.ItemId.Equals(itemId)).ExecuteDelete(); + context.SaveChanges(); + } + private Chapter Map(ChapterInfo chapterInfo, int index, Guid itemId) { return new Chapter() @@ -117,7 +112,12 @@ public class ChapterRepository : IChapterRepository ImagePath = chapterInfo.ImagePath, Name = chapterInfo.Name, }; - chapterEntity.ImageTag = _imageProcessor.GetImageCacheTag(baseItemPath, chapterEntity.ImageDateModified); + + if (!string.IsNullOrEmpty(chapterInfo.ImagePath)) + { + chapterEntity.ImageTag = _imageProcessor.GetImageCacheTag(baseItemPath, chapterEntity.ImageDateModified); + } + return chapterEntity; } } diff --git a/Jellyfin.Server.Implementations/Item/KeyframeRepository.cs b/Jellyfin.Server.Implementations/Item/KeyframeRepository.cs new file mode 100644 index 000000000..93c6f472e --- /dev/null +++ b/Jellyfin.Server.Implementations/Item/KeyframeRepository.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; +using MediaBrowser.Controller.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace Jellyfin.Server.Implementations.Item; + +/// <summary> +/// Repository for obtaining Keyframe data. +/// </summary> +public class KeyframeRepository : IKeyframeRepository +{ + private readonly IDbContextFactory<JellyfinDbContext> _dbProvider; + + /// <summary> + /// Initializes a new instance of the <see cref="KeyframeRepository"/> class. + /// </summary> + /// <param name="dbProvider">The EFCore db factory.</param> + public KeyframeRepository(IDbContextFactory<JellyfinDbContext> dbProvider) + { + _dbProvider = dbProvider; + } + + private static MediaEncoding.Keyframes.KeyframeData Map(KeyframeData entity) + { + return new MediaEncoding.Keyframes.KeyframeData( + entity.TotalDuration, + (entity.KeyframeTicks ?? []).ToList()); + } + + private KeyframeData Map(MediaEncoding.Keyframes.KeyframeData dto, Guid itemId) + { + return new() + { + ItemId = itemId, + TotalDuration = dto.TotalDuration, + KeyframeTicks = dto.KeyframeTicks.ToList() + }; + } + + /// <inheritdoc /> + public IReadOnlyList<MediaEncoding.Keyframes.KeyframeData> GetKeyframeData(Guid itemId) + { + using var context = _dbProvider.CreateDbContext(); + + return context.KeyframeData.AsNoTracking().Where(e => e.ItemId.Equals(itemId)).Select(e => Map(e)).ToList(); + } + + /// <inheritdoc /> + public async Task SaveKeyframeDataAsync(Guid itemId, MediaEncoding.Keyframes.KeyframeData data, CancellationToken cancellationToken) + { + using var context = _dbProvider.CreateDbContext(); + using var transaction = await context.Database.BeginTransactionAsync(cancellationToken).ConfigureAwait(false); + await context.KeyframeData.Where(e => e.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + await context.KeyframeData.AddAsync(Map(data, itemId), cancellationToken).ConfigureAwait(false); + await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + await transaction.CommitAsync(cancellationToken).ConfigureAwait(false); + } + + /// <inheritdoc /> + public async Task DeleteKeyframeDataAsync(Guid itemId, CancellationToken cancellationToken) + { + using var context = _dbProvider.CreateDbContext(); + await context.KeyframeData.Where(e => e.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + } +} diff --git a/Jellyfin.Server.Implementations/Item/MediaAttachmentRepository.cs b/Jellyfin.Server.Implementations/Item/MediaAttachmentRepository.cs index 155798209..e75dda439 100644 --- a/Jellyfin.Server.Implementations/Item/MediaAttachmentRepository.cs +++ b/Jellyfin.Server.Implementations/Item/MediaAttachmentRepository.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using Microsoft.EntityFrameworkCore; @@ -24,8 +25,16 @@ public class MediaAttachmentRepository(IDbContextFactory<JellyfinDbContext> dbPr { using var context = dbProvider.CreateDbContext(); using var transaction = context.Database.BeginTransaction(); + + // Users may replace a media with a version that includes attachments to one without them. + // So when saving attachments is triggered by a library scan, we always unconditionally + // clear the old ones, and then add the new ones if given. context.AttachmentStreamInfos.Where(e => e.ItemId.Equals(id)).ExecuteDelete(); - context.AttachmentStreamInfos.AddRange(attachments.Select(e => Map(e, id))); + if (attachments.Any()) + { + context.AttachmentStreamInfos.AddRange(attachments.Select(e => Map(e, id))); + } + context.SaveChanges(); transaction.Commit(); } diff --git a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs index f47e3fdfd..7eb13b740 100644 --- a/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs +++ b/Jellyfin.Server.Implementations/Item/MediaStreamRepository.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; @@ -99,7 +100,18 @@ public class MediaStreamRepository : IMediaStreamRepository dto.IsAVC = entity.IsAvc; dto.Codec = entity.Codec; - dto.Language = entity.Language; + + var language = entity.Language; + + // Check if the language has multiple three letter ISO codes + // if yes choose the first as that is the ISO 639-2/T code we're needing + if (language != null && _localization.TryGetISO6392TFromB(language, out string? isoT)) + { + language = isoT; + } + + dto.Language = language; + dto.ChannelLayout = entity.ChannelLayout; dto.Profile = entity.Profile; dto.AspectRatio = entity.AspectRatio; @@ -139,6 +151,7 @@ public class MediaStreamRepository : IMediaStreamRepository dto.DvBlSignalCompatibilityId = entity.DvBlSignalCompatibilityId; dto.IsHearingImpaired = entity.IsHearingImpaired.GetValueOrDefault(); dto.Rotation = entity.Rotation; + dto.Hdr10PlusPresentFlag = entity.Hdr10PlusPresentFlag; if (dto.Type is MediaStreamType.Audio or MediaStreamType.Subtitle) { @@ -206,7 +219,8 @@ public class MediaStreamRepository : IMediaStreamRepository BlPresentFlag = dto.BlPresentFlag, DvBlSignalCompatibilityId = dto.DvBlSignalCompatibilityId, IsHearingImpaired = dto.IsHearingImpaired, - Rotation = dto.Rotation + Rotation = dto.Rotation, + Hdr10PlusPresentFlag = dto.Hdr10PlusPresentFlag, }; return entity; } diff --git a/Jellyfin.Server.Implementations/Item/OrderMapper.cs b/Jellyfin.Server.Implementations/Item/OrderMapper.cs new file mode 100644 index 000000000..a0c127031 --- /dev/null +++ b/Jellyfin.Server.Implementations/Item/OrderMapper.cs @@ -0,0 +1,57 @@ +using System; +using System.Linq; +using System.Linq.Expressions; +using Jellyfin.Data.Enums; +using Jellyfin.Database.Implementations.Entities; +using MediaBrowser.Controller.Entities; +using Microsoft.EntityFrameworkCore; + +namespace Jellyfin.Server.Implementations.Item; + +/// <summary> +/// Static class for methods which maps types of ordering to their respecting ordering functions. +/// </summary> +public static class OrderMapper +{ + /// <summary> + /// Creates Func to be executed later with a given BaseItemEntity input for sorting items on query. + /// </summary> + /// <param name="sortBy">Item property to sort by.</param> + /// <param name="query">Context Query.</param> + /// <returns>Func to be executed later for sorting query.</returns> + public static Expression<Func<BaseItemEntity, object?>> MapOrderByField(ItemSortBy sortBy, InternalItemsQuery query) + { + return sortBy switch + { + ItemSortBy.AirTime => e => e.SortName, // TODO + ItemSortBy.Runtime => e => e.RunTimeTicks, + ItemSortBy.Random => e => EF.Functions.Random(), + ItemSortBy.DatePlayed => e => e.UserData!.FirstOrDefault(f => f.UserId.Equals(query.User!.Id))!.LastPlayedDate, + ItemSortBy.PlayCount => e => e.UserData!.FirstOrDefault(f => f.UserId.Equals(query.User!.Id))!.PlayCount, + ItemSortBy.IsFavoriteOrLiked => e => e.UserData!.FirstOrDefault(f => f.UserId.Equals(query.User!.Id))!.IsFavorite, + ItemSortBy.IsFolder => e => e.IsFolder, + ItemSortBy.IsPlayed => e => e.UserData!.FirstOrDefault(f => f.UserId.Equals(query.User!.Id))!.Played, + ItemSortBy.IsUnplayed => e => !e.UserData!.FirstOrDefault(f => f.UserId.Equals(query.User!.Id))!.Played, + ItemSortBy.DateLastContentAdded => e => e.DateLastMediaAdded, + ItemSortBy.Artist => e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.Artist).Select(f => f.ItemValue.CleanValue).FirstOrDefault(), + ItemSortBy.AlbumArtist => e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.AlbumArtist).Select(f => f.ItemValue.CleanValue).FirstOrDefault(), + ItemSortBy.Studio => e => e.ItemValues!.Where(f => f.ItemValue.Type == ItemValueType.Studios).Select(f => f.ItemValue.CleanValue).FirstOrDefault(), + ItemSortBy.OfficialRating => e => e.InheritedParentalRatingValue, + // ItemSortBy.SeriesDatePlayed => "(Select MAX(LastPlayedDate) from TypedBaseItems B" + GetJoinUserDataText(query) + " where Played=1 and B.SeriesPresentationUniqueKey=A.PresentationUniqueKey)", + ItemSortBy.SeriesSortName => e => e.SeriesName, + // ItemSortBy.AiredEpisodeOrder => "AiredEpisodeOrder", + ItemSortBy.Album => e => e.Album, + ItemSortBy.DateCreated => e => e.DateCreated, + ItemSortBy.PremiereDate => e => (e.PremiereDate ?? (e.ProductionYear.HasValue ? DateTime.MinValue.AddYears(e.ProductionYear.Value - 1) : null)), + ItemSortBy.StartDate => e => e.StartDate, + ItemSortBy.Name => e => e.CleanName, + ItemSortBy.CommunityRating => e => e.CommunityRating, + ItemSortBy.ProductionYear => e => e.ProductionYear, + ItemSortBy.CriticRating => e => e.CriticRating, + ItemSortBy.VideoBitRate => e => e.TotalBitrate, + ItemSortBy.ParentIndexNumber => e => e.ParentIndexNumber, + ItemSortBy.IndexNumber => e => e.IndexNumber, + _ => e => e.SortName + }; + } +} diff --git a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs index a8dfd4cd3..be58e2a52 100644 --- a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs +++ b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs @@ -2,8 +2,10 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using Jellyfin.Data.Entities; using Jellyfin.Data.Enums; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; +using Jellyfin.Database.Implementations.Entities.Libraries; using Jellyfin.Extensions; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Persistence; @@ -39,6 +41,12 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I dbQuery = dbQuery.Take(filter.Limit); } + // Include PeopleBaseItemMap + if (!filter.ItemId.IsEmpty()) + { + dbQuery = dbQuery.Include(p => p.BaseItems!.Where(m => m.ItemId == filter.ItemId)); + } + return dbQuery.AsEnumerable().Select(Map).ToArray(); } @@ -46,7 +54,7 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I public IReadOnlyList<string> GetPeopleNames(InternalPeopleQuery filter) { using var context = _dbProvider.CreateDbContext(); - var dbQuery = TranslateQuery(context.Peoples.AsNoTracking(), context, filter); + var dbQuery = TranslateQuery(context.Peoples.AsNoTracking(), context, filter).Select(e => e.Name).Distinct(); // dbQuery = dbQuery.OrderBy(e => e.ListOrder); if (filter.Limit > 0) @@ -54,49 +62,59 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I dbQuery = dbQuery.Take(filter.Limit); } - return dbQuery.Select(e => e.Name).ToArray(); + return dbQuery.ToArray(); } /// <inheritdoc /> public void UpdatePeople(Guid itemId, IReadOnlyList<PersonInfo> people) { using var context = _dbProvider.CreateDbContext(); - using var transaction = context.Database.BeginTransaction(); - context.PeopleBaseItemMap.Where(e => e.ItemId == itemId).ExecuteDelete(); // TODO: yes for __SOME__ reason there can be duplicates. - foreach (var item in people.DistinctBy(e => e.Id)) + people = people.DistinctBy(e => e.Id).ToArray(); + var personids = people.Select(f => f.Id); + var existingPersons = context.Peoples.Where(p => personids.Contains(p.Id)).Select(f => f.Id).ToArray(); + context.Peoples.AddRange(people.Where(e => !existingPersons.Contains(e.Id)).Select(Map)); + context.SaveChanges(); + + var maps = context.PeopleBaseItemMap.Where(e => e.ItemId == itemId).ToList(); + foreach (var person in people) { - var personEntity = Map(item); - var existingEntity = context.Peoples.FirstOrDefault(e => e.Id == personEntity.Id); - if (existingEntity is null) + var existingMap = maps.FirstOrDefault(e => e.PeopleId == person.Id); + if (existingMap is null) { - context.Peoples.Add(personEntity); - existingEntity = personEntity; + context.PeopleBaseItemMap.Add(new PeopleBaseItemMap() + { + Item = null!, + ItemId = itemId, + People = null!, + PeopleId = person.Id, + ListOrder = person.SortOrder, + SortOrder = person.SortOrder, + Role = person.Role + }); } - - context.PeopleBaseItemMap.Add(new PeopleBaseItemMap() + else { - Item = null!, - ItemId = itemId, - People = existingEntity, - PeopleId = existingEntity.Id, - ListOrder = item.SortOrder, - SortOrder = item.SortOrder, - Role = item.Role - }); + // person mapping already exists so remove from list + maps.Remove(existingMap); + } } + context.PeopleBaseItemMap.RemoveRange(maps); + context.SaveChanges(); - transaction.Commit(); } private PersonInfo Map(People people) { + var mapping = people.BaseItems?.FirstOrDefault(); var personInfo = new PersonInfo() { Id = people.Id, Name = people.Name, + Role = mapping?.Role, + SortOrder = mapping?.SortOrder }; if (Enum.TryParse<PersonKind>(people.PersonType, out var kind)) { @@ -123,9 +141,13 @@ public class PeopleRepository(IDbContextFactory<JellyfinDbContext> dbProvider, I if (filter.User is not null && filter.IsFavorite.HasValue) { var personType = itemTypeLookup.BaseItemKindNames[BaseItemKind.Person]; - query = query.Where(e => e.PersonType == personType) - .Where(e => context.BaseItems.Where(d => d.UserData!.Any(w => w.IsFavorite == filter.IsFavorite && w.UserId.Equals(filter.User.Id))) - .Select(f => f.Name).Contains(e.Name)); + var oldQuery = query; + + query = context.UserData + .Where(u => u.Item!.Type == personType && u.IsFavorite == filter.IsFavorite && u.UserId.Equals(filter.User.Id)) + .Join(oldQuery, e => e.Item!.Name, e => e.Name, (item, person) => person) + .Distinct() + .AsNoTracking(); } if (!filter.ItemId.IsEmpty()) diff --git a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj index 31cf24fb2..6693ab8db 100644 --- a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj +++ b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj @@ -28,22 +28,15 @@ <ItemGroup> <PackageReference Include="AsyncKeyedLock" /> <PackageReference Include="System.Linq.Async" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Design"> - <PrivateAssets>all</PrivateAssets> - <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> - </PackageReference> - <PackageReference Include="Microsoft.EntityFrameworkCore.Tools"> - <PrivateAssets>all</PrivateAssets> - <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> - </PackageReference> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Jellyfin.Data\Jellyfin.Data.csproj" /> <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" /> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> + <ProjectReference Include="..\src\Jellyfin.Database\Jellyfin.Database.Implementations\Jellyfin.Database.Implementations.csproj" /> + <ProjectReference Include="..\src\Jellyfin.Database\Jellyfin.Database.Providers.Sqlite\Jellyfin.Database.Providers.Sqlite.csproj" /> </ItemGroup> </Project> diff --git a/Jellyfin.Server.Implementations/JellyfinDbContext.cs b/Jellyfin.Server.Implementations/JellyfinDbContext.cs deleted file mode 100644 index 34d9e3960..000000000 --- a/Jellyfin.Server.Implementations/JellyfinDbContext.cs +++ /dev/null @@ -1,274 +0,0 @@ -using System; -using System.Linq; -using Jellyfin.Data.Entities; -using Jellyfin.Data.Entities.Security; -using Jellyfin.Data.Interfaces; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; - -namespace Jellyfin.Server.Implementations; - -/// <inheritdoc/> -/// <summary> -/// Initializes a new instance of the <see cref="JellyfinDbContext"/> class. -/// </summary> -/// <param name="options">The database context options.</param> -/// <param name="logger">Logger.</param> -public class JellyfinDbContext(DbContextOptions<JellyfinDbContext> options, ILogger<JellyfinDbContext> logger) : DbContext(options) -{ - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the access schedules. - /// </summary> - public DbSet<AccessSchedule> AccessSchedules => Set<AccessSchedule>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the activity logs. - /// </summary> - public DbSet<ActivityLog> ActivityLogs => Set<ActivityLog>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the API keys. - /// </summary> - public DbSet<ApiKey> ApiKeys => Set<ApiKey>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the devices. - /// </summary> - public DbSet<Device> Devices => Set<Device>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the device options. - /// </summary> - public DbSet<DeviceOptions> DeviceOptions => Set<DeviceOptions>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the display preferences. - /// </summary> - public DbSet<DisplayPreferences> DisplayPreferences => Set<DisplayPreferences>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the image infos. - /// </summary> - public DbSet<ImageInfo> ImageInfos => Set<ImageInfo>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the item display preferences. - /// </summary> - public DbSet<ItemDisplayPreferences> ItemDisplayPreferences => Set<ItemDisplayPreferences>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the custom item display preferences. - /// </summary> - public DbSet<CustomItemDisplayPreferences> CustomItemDisplayPreferences => Set<CustomItemDisplayPreferences>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the permissions. - /// </summary> - public DbSet<Permission> Permissions => Set<Permission>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the preferences. - /// </summary> - public DbSet<Preference> Preferences => Set<Preference>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the users. - /// </summary> - public DbSet<User> Users => Set<User>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the trickplay metadata. - /// </summary> - public DbSet<TrickplayInfo> TrickplayInfos => Set<TrickplayInfo>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the media segments. - /// </summary> - public DbSet<MediaSegment> MediaSegments => Set<MediaSegment>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the user data. - /// </summary> - public DbSet<UserData> UserData => Set<UserData>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the user data. - /// </summary> - public DbSet<AncestorId> AncestorIds => Set<AncestorId>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the user data. - /// </summary> - public DbSet<AttachmentStreamInfo> AttachmentStreamInfos => Set<AttachmentStreamInfo>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the user data. - /// </summary> - public DbSet<BaseItemEntity> BaseItems => Set<BaseItemEntity>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the user data. - /// </summary> - public DbSet<Chapter> Chapters => Set<Chapter>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<ItemValue> ItemValues => Set<ItemValue>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<ItemValueMap> ItemValuesMap => Set<ItemValueMap>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<MediaStreamInfo> MediaStreamInfos => Set<MediaStreamInfo>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<People> Peoples => Set<People>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<PeopleBaseItemMap> PeopleBaseItemMap => Set<PeopleBaseItemMap>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/> containing the referenced Providers with ids. - /// </summary> - public DbSet<BaseItemProvider> BaseItemProviders => Set<BaseItemProvider>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<BaseItemImageInfo> BaseItemImageInfos => Set<BaseItemImageInfo>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<BaseItemMetadataField> BaseItemMetadataFields => Set<BaseItemMetadataField>(); - - /// <summary> - /// Gets the <see cref="DbSet{TEntity}"/>. - /// </summary> - public DbSet<BaseItemTrailerType> BaseItemTrailerTypes => Set<BaseItemTrailerType>(); - - /*public DbSet<Artwork> Artwork => Set<Artwork>(); - - public DbSet<Book> Books => Set<Book>(); - - public DbSet<BookMetadata> BookMetadata => Set<BookMetadata>(); - - public DbSet<Chapter> Chapters => Set<Chapter>(); - - public DbSet<Collection> Collections => Set<Collection>(); - - public DbSet<CollectionItem> CollectionItems => Set<CollectionItem>(); - - public DbSet<Company> Companies => Set<Company>(); - - public DbSet<CompanyMetadata> CompanyMetadata => Set<CompanyMetadata>(); - - public DbSet<CustomItem> CustomItems => Set<CustomItem>(); - - public DbSet<CustomItemMetadata> CustomItemMetadata => Set<CustomItemMetadata>(); - - public DbSet<Episode> Episodes => Set<Episode>(); - - public DbSet<EpisodeMetadata> EpisodeMetadata => Set<EpisodeMetadata>(); - - public DbSet<Genre> Genres => Set<Genre>(); - - public DbSet<Group> Groups => Set<Groups>(); - - public DbSet<Library> Libraries => Set<Library>(); - - public DbSet<LibraryItem> LibraryItems => Set<LibraryItems>(); - - public DbSet<LibraryRoot> LibraryRoot => Set<LibraryRoot>(); - - public DbSet<MediaFile> MediaFiles => Set<MediaFiles>(); - - public DbSet<MediaFileStream> MediaFileStream => Set<MediaFileStream>(); - - public DbSet<Metadata> Metadata => Set<Metadata>(); - - public DbSet<MetadataProvider> MetadataProviders => Set<MetadataProvider>(); - - public DbSet<MetadataProviderId> MetadataProviderIds => Set<MetadataProviderId>(); - - public DbSet<Movie> Movies => Set<Movie>(); - - public DbSet<MovieMetadata> MovieMetadata => Set<MovieMetadata>(); - - public DbSet<MusicAlbum> MusicAlbums => Set<MusicAlbum>(); - - public DbSet<MusicAlbumMetadata> MusicAlbumMetadata => Set<MusicAlbumMetadata>(); - - public DbSet<Person> People => Set<Person>(); - - public DbSet<PersonRole> PersonRoles => Set<PersonRole>(); - - public DbSet<Photo> Photo => Set<Photo>(); - - public DbSet<PhotoMetadata> PhotoMetadata => Set<PhotoMetadata>(); - - public DbSet<ProviderMapping> ProviderMappings => Set<ProviderMapping>(); - - public DbSet<Rating> Ratings => Set<Rating>(); - - /// <summary> - /// Repository for global::Jellyfin.Data.Entities.RatingSource - This is the entity to - /// store review ratings, not age ratings. - /// </summary> - public DbSet<RatingSource> RatingSources => Set<RatingSource>(); - - public DbSet<Release> Releases => Set<Release>(); - - public DbSet<Season> Seasons => Set<Season>(); - - public DbSet<SeasonMetadata> SeasonMetadata => Set<SeasonMetadata>(); - - public DbSet<Series> Series => Set<Series>(); - - public DbSet<SeriesMetadata> SeriesMetadata => Set<SeriesMetadata(); - - public DbSet<Track> Tracks => Set<Track>(); - - public DbSet<TrackMetadata> TrackMetadata => Set<TrackMetadata>();*/ - - /// <inheritdoc/> - public override int SaveChanges() - { - foreach (var saveEntity in ChangeTracker.Entries() - .Where(e => e.State == EntityState.Modified) - .Select(entry => entry.Entity) - .OfType<IHasConcurrencyToken>()) - { - saveEntity.OnSavingChanges(); - } - - try - { - return base.SaveChanges(); - } - catch (Exception e) - { - logger.LogError(e, "Error trying to save changes."); - throw; - } - } - - /// <inheritdoc /> - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.SetDefaultDateTimeKind(DateTimeKind.Utc); - base.OnModelCreating(modelBuilder); - - // Configuration for each entity is in its own class inside 'ModelConfiguration'. - modelBuilder.ApplyConfigurationsFromAssembly(typeof(JellyfinDbContext).Assembly); - } -} diff --git a/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs b/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs index 59ec418ce..97c9d79f5 100644 --- a/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs +++ b/Jellyfin.Server.Implementations/MediaSegments/MediaSegmentManager.cs @@ -5,16 +5,17 @@ using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Jellyfin.Data.Entities; -using Jellyfin.Data.Enums; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; +using Jellyfin.Database.Implementations.Enums; using Jellyfin.Extensions; using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.MediaSegments; using MediaBrowser.Controller.Providers; using MediaBrowser.Model; +using MediaBrowser.Model.Configuration; using MediaBrowser.Model.MediaSegments; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -29,7 +30,6 @@ public class MediaSegmentManager : IMediaSegmentManager private readonly ILogger<MediaSegmentManager> _logger; private readonly IDbContextFactory<JellyfinDbContext> _dbProvider; private readonly IMediaSegmentProvider[] _segmentProviders; - private readonly ILibraryManager _libraryManager; /// <summary> /// Initializes a new instance of the <see cref="MediaSegmentManager"/> class. @@ -37,12 +37,10 @@ public class MediaSegmentManager : IMediaSegmentManager /// <param name="logger">Logger.</param> /// <param name="dbProvider">EFCore Database factory.</param> /// <param name="segmentProviders">List of all media segment providers.</param> - /// <param name="libraryManager">Library manager.</param> public MediaSegmentManager( ILogger<MediaSegmentManager> logger, IDbContextFactory<JellyfinDbContext> dbProvider, - IEnumerable<IMediaSegmentProvider> segmentProviders, - ILibraryManager libraryManager) + IEnumerable<IMediaSegmentProvider> segmentProviders) { _logger = logger; _dbProvider = dbProvider; @@ -50,13 +48,11 @@ public class MediaSegmentManager : IMediaSegmentManager _segmentProviders = segmentProviders .OrderBy(i => i is IHasOrder hasOrder ? hasOrder.Order : 0) .ToArray(); - _libraryManager = libraryManager; } /// <inheritdoc/> - public async Task RunSegmentPluginProviders(BaseItem baseItem, bool overwrite, CancellationToken cancellationToken) + public async Task RunSegmentPluginProviders(BaseItem baseItem, LibraryOptions libraryOptions, bool forceOverwrite, CancellationToken cancellationToken) { - var libraryOptions = _libraryManager.GetLibraryOptions(baseItem); var providers = _segmentProviders .Where(e => !libraryOptions.DisabledMediaSegmentProviders.Contains(GetProviderId(e.Name))) .OrderBy(i => @@ -74,18 +70,13 @@ public class MediaSegmentManager : IMediaSegmentManager using var db = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false); - if (!overwrite && (await db.MediaSegments.AnyAsync(e => e.ItemId.Equals(baseItem.Id), cancellationToken).ConfigureAwait(false))) - { - _logger.LogDebug("Skip {MediaPath} as it already contains media segments", baseItem.Path); - return; - } - _logger.LogDebug("Start media segment extraction for {MediaPath} with {CountProviders} providers enabled", baseItem.Path, providers.Count); - await db.MediaSegments.Where(e => e.ItemId.Equals(baseItem.Id)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); - - // no need to recreate the request object every time. - var requestItem = new MediaSegmentGenerationRequest() { ItemId = baseItem.Id }; + if (forceOverwrite) + { + // delete all existing media segments if forceOverwrite is set. + await db.MediaSegments.Where(e => e.ItemId.Equals(baseItem.Id)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + } foreach (var provider in providers) { @@ -95,15 +86,56 @@ public class MediaSegmentManager : IMediaSegmentManager continue; } + IQueryable<MediaSegment> existingSegments; + if (forceOverwrite) + { + existingSegments = Array.Empty<MediaSegment>().AsQueryable(); + } + else + { + existingSegments = db.MediaSegments.Where(e => e.ItemId.Equals(baseItem.Id) && e.SegmentProviderId == GetProviderId(provider.Name)); + } + + var requestItem = new MediaSegmentGenerationRequest() + { + ItemId = baseItem.Id, + ExistingSegments = existingSegments.Select(e => Map(e)).ToArray() + }; + try { var segments = await provider.GetMediaSegments(requestItem, cancellationToken) .ConfigureAwait(false); - if (segments.Count == 0) + + if (!forceOverwrite) + { + var existingSegmentsList = existingSegments.ToArray(); // Cannot use requestItem's list, as the provider might tamper with its items. + if (segments.Count == requestItem.ExistingSegments.Count && segments.All(e => existingSegmentsList.Any(f => + { + return + e.StartTicks == f.StartTicks && + e.EndTicks == f.EndTicks && + e.Type == f.Type; + }))) + { + _logger.LogDebug("Media Segment provider {ProviderName} did not modify any segments for {MediaPath}", provider.Name, baseItem.Path); + continue; + } + + // delete existing media segments that were re-generated. + await existingSegments.ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + } + + if (segments.Count == 0 && !requestItem.ExistingSegments.Any()) { _logger.LogDebug("Media Segment provider {ProviderName} did not find any segments for {MediaPath}", provider.Name, baseItem.Path); continue; } + else if (segments.Count == 0 && requestItem.ExistingSegments.Any()) + { + _logger.LogDebug("Media Segment provider {ProviderName} deleted all segments for {MediaPath}", provider.Name, baseItem.Path); + continue; + } _logger.LogInformation("Media Segment provider {ProviderName} found {CountSegments} for {MediaPath}", provider.Name, segments.Count, baseItem.Path); var providerId = GetProviderId(provider.Name); @@ -139,22 +171,21 @@ public class MediaSegmentManager : IMediaSegmentManager } /// <inheritdoc /> - public async Task<IEnumerable<MediaSegmentDto>> GetSegmentsAsync(Guid itemId, IEnumerable<MediaSegmentType>? typeFilter, bool filterByProvider = true) + public async Task DeleteSegmentsAsync(Guid itemId, CancellationToken cancellationToken) { - var baseItem = _libraryManager.GetItemById(itemId); + using var db = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false); + await db.MediaSegments.Where(e => e.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + } - if (baseItem is null) + /// <inheritdoc /> + public async Task<IEnumerable<MediaSegmentDto>> GetSegmentsAsync(BaseItem? item, IEnumerable<MediaSegmentType>? typeFilter, LibraryOptions libraryOptions, bool filterByProvider = true) + { + if (item is null) { _logger.LogError("Tried to request segments for an invalid item"); return []; } - return await GetSegmentsAsync(baseItem, typeFilter, filterByProvider).ConfigureAwait(false); - } - - /// <inheritdoc /> - public async Task<IEnumerable<MediaSegmentDto>> GetSegmentsAsync(BaseItem item, IEnumerable<MediaSegmentType>? typeFilter, bool filterByProvider = true) - { using var db = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); var query = db.MediaSegments @@ -167,7 +198,6 @@ public class MediaSegmentManager : IMediaSegmentManager if (filterByProvider) { - var libraryOptions = _libraryManager.GetLibraryOptions(item); var providerIds = _segmentProviders .Where(e => !libraryOptions.DisabledMediaSegmentProviders.Contains(GetProviderId(e.Name))) .Select(f => GetProviderId(f.Name)) diff --git a/Jellyfin.Server.Implementations/Migrations/.gitattributes b/Jellyfin.Server.Implementations/Migrations/.gitattributes deleted file mode 100644 index da5c26f40..000000000 --- a/Jellyfin.Server.Implementations/Migrations/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -JellyfinDbModelSnapshot.cs binary diff --git a/Jellyfin.Server.Implementations/Migrations/20200514181226_AddActivityLog.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20200514181226_AddActivityLog.Designer.cs deleted file mode 100644 index 80fe784dd..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200514181226_AddActivityLog.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20200514181226_AddActivityLog")] - partial class AddActivityLog - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "3.1.3"); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Overview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200514181226_AddActivityLog.cs b/Jellyfin.Server.Implementations/Migrations/20200514181226_AddActivityLog.cs deleted file mode 100644 index 002e5296e..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200514181226_AddActivityLog.cs +++ /dev/null @@ -1,46 +0,0 @@ -#pragma warning disable CS1591 -#pragma warning disable SA1601 - -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddActivityLog : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "jellyfin"); - - migrationBuilder.CreateTable( - name: "ActivityLogs", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column<string>(maxLength: 512, nullable: false), - Overview = table.Column<string>(maxLength: 512, nullable: true), - ShortOverview = table.Column<string>(maxLength: 512, nullable: true), - Type = table.Column<string>(maxLength: 256, nullable: false), - UserId = table.Column<Guid>(nullable: false), - ItemId = table.Column<string>(maxLength: 256, nullable: true), - DateCreated = table.Column<DateTime>(nullable: false), - LogSeverity = table.Column<int>(nullable: false), - RowVersion = table.Column<uint>(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ActivityLogs", x => x.Id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ActivityLogs", - schema: "jellyfin"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200613202153_AddUsers.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20200613202153_AddUsers.Designer.cs deleted file mode 100644 index 7aa4479b3..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200613202153_AddUsers.Designer.cs +++ /dev/null @@ -1,312 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20200613202153_AddUsers")] - partial class AddUsers - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "3.1.4"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Overview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Permission_Permissions_Guid"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.HasKey("Id"); - - b.HasIndex("Preference_Preferences_Guid"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Guid"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200613202153_AddUsers.cs b/Jellyfin.Server.Implementations/Migrations/20200613202153_AddUsers.cs deleted file mode 100644 index 706a97ba2..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200613202153_AddUsers.cs +++ /dev/null @@ -1,197 +0,0 @@ -#pragma warning disable CS1591 -#pragma warning disable SA1601 - -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddUsers : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Users", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<Guid>(nullable: false), - Username = table.Column<string>(maxLength: 255, nullable: false), - Password = table.Column<string>(maxLength: 65535, nullable: true), - EasyPassword = table.Column<string>(maxLength: 65535, nullable: true), - MustUpdatePassword = table.Column<bool>(nullable: false), - AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: true), - AuthenticationProviderId = table.Column<string>(maxLength: 255, nullable: false), - PasswordResetProviderId = table.Column<string>(maxLength: 255, nullable: false), - InvalidLoginAttemptCount = table.Column<int>(nullable: false), - LastActivityDate = table.Column<DateTime>(nullable: true), - LastLoginDate = table.Column<DateTime>(nullable: true), - LoginAttemptsBeforeLockout = table.Column<int>(nullable: true), - SubtitleMode = table.Column<int>(nullable: false), - PlayDefaultAudioTrack = table.Column<bool>(nullable: false), - SubtitleLanguagePreference = table.Column<string>(maxLength: 255, nullable: true), - DisplayMissingEpisodes = table.Column<bool>(nullable: false), - DisplayCollectionsView = table.Column<bool>(nullable: false), - EnableLocalPassword = table.Column<bool>(nullable: false), - HidePlayedInLatest = table.Column<bool>(nullable: false), - RememberAudioSelections = table.Column<bool>(nullable: false), - RememberSubtitleSelections = table.Column<bool>(nullable: false), - EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: false), - EnableAutoLogin = table.Column<bool>(nullable: false), - EnableUserPreferenceAccess = table.Column<bool>(nullable: false), - MaxParentalAgeRating = table.Column<int>(nullable: true), - RemoteClientBitrateLimit = table.Column<int>(nullable: true), - InternalId = table.Column<long>(nullable: false), - SyncPlayAccess = table.Column<int>(nullable: false), - RowVersion = table.Column<uint>(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AccessSchedules", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column<Guid>(nullable: false), - DayOfWeek = table.Column<int>(nullable: false), - StartHour = table.Column<double>(nullable: false), - EndHour = table.Column<double>(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccessSchedules", x => x.Id); - table.ForeignKey( - name: "FK_AccessSchedules_Users_UserId", - column: x => x.UserId, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ImageInfos", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column<Guid>(nullable: true), - Path = table.Column<string>(maxLength: 512, nullable: false), - LastModified = table.Column<DateTime>(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ImageInfos", x => x.Id); - table.ForeignKey( - name: "FK_ImageInfos_Users_UserId", - column: x => x.UserId, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Permissions", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Kind = table.Column<int>(nullable: false), - Value = table.Column<bool>(nullable: false), - RowVersion = table.Column<uint>(nullable: false), - Permission_Permissions_Guid = table.Column<Guid>(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Permissions", x => x.Id); - table.ForeignKey( - name: "FK_Permissions_Users_Permission_Permissions_Guid", - column: x => x.Permission_Permissions_Guid, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Preferences", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Kind = table.Column<int>(nullable: false), - Value = table.Column<string>(maxLength: 65535, nullable: false), - RowVersion = table.Column<uint>(nullable: false), - Preference_Preferences_Guid = table.Column<Guid>(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Preferences", x => x.Id); - table.ForeignKey( - name: "FK_Preferences_Users_Preference_Preferences_Guid", - column: x => x.Preference_Preferences_Guid, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccessSchedules_UserId", - schema: "jellyfin", - table: "AccessSchedules", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_ImageInfos_UserId", - schema: "jellyfin", - table: "ImageInfos", - column: "UserId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Permissions_Permission_Permissions_Guid", - schema: "jellyfin", - table: "Permissions", - column: "Permission_Permissions_Guid"); - - migrationBuilder.CreateIndex( - name: "IX_Preferences_Preference_Preferences_Guid", - schema: "jellyfin", - table: "Preferences", - column: "Preference_Preferences_Guid"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccessSchedules", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "ImageInfos", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "Permissions", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "Preferences", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "Users", - schema: "jellyfin"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.Designer.cs deleted file mode 100644 index 3860c851d..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.Designer.cs +++ /dev/null @@ -1,459 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20200728005145_AddDisplayPreferences")] - partial class AddDisplayPreferences - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "3.1.6"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Overview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<string>("DashboardTheme") - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(64); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Permission_Permissions_Guid"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.HasKey("Id"); - - b.HasIndex("Preference_Preferences_Guid"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("DisplayPreferences") - .HasForeignKey("Jellyfin.Data.Entities.DisplayPreferences", "UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Guid"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.cs b/Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.cs deleted file mode 100644 index 8cd551642..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.cs +++ /dev/null @@ -1,132 +0,0 @@ -#pragma warning disable CS1591 -#pragma warning disable SA1601 - -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddDisplayPreferences : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "DisplayPreferences", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column<Guid>(nullable: false), - Client = table.Column<string>(maxLength: 32, nullable: false), - ShowSidebar = table.Column<bool>(nullable: false), - ShowBackdrop = table.Column<bool>(nullable: false), - ScrollDirection = table.Column<int>(nullable: false), - IndexBy = table.Column<int>(nullable: true), - SkipForwardLength = table.Column<int>(nullable: false), - SkipBackwardLength = table.Column<int>(nullable: false), - ChromecastVersion = table.Column<int>(nullable: false), - EnableNextVideoInfoOverlay = table.Column<bool>(nullable: false), - DashboardTheme = table.Column<string>(maxLength: 32, nullable: true), - TvHome = table.Column<string>(maxLength: 32, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DisplayPreferences", x => x.Id); - table.ForeignKey( - name: "FK_DisplayPreferences_Users_UserId", - column: x => x.UserId, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ItemDisplayPreferences", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column<Guid>(nullable: false), - ItemId = table.Column<Guid>(nullable: false), - Client = table.Column<string>(maxLength: 32, nullable: false), - ViewType = table.Column<int>(nullable: false), - RememberIndexing = table.Column<bool>(nullable: false), - IndexBy = table.Column<int>(nullable: true), - RememberSorting = table.Column<bool>(nullable: false), - SortBy = table.Column<string>(maxLength: 64, nullable: false), - SortOrder = table.Column<int>(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ItemDisplayPreferences", x => x.Id); - table.ForeignKey( - name: "FK_ItemDisplayPreferences_Users_UserId", - column: x => x.UserId, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "HomeSection", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DisplayPreferencesId = table.Column<int>(nullable: false), - Order = table.Column<int>(nullable: false), - Type = table.Column<int>(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_HomeSection", x => x.Id); - table.ForeignKey( - name: "FK_HomeSection_DisplayPreferences_DisplayPreferencesId", - column: x => x.DisplayPreferencesId, - principalSchema: "jellyfin", - principalTable: "DisplayPreferences", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences", - column: "UserId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_HomeSection_DisplayPreferencesId", - schema: "jellyfin", - table: "HomeSection", - column: "DisplayPreferencesId"); - - migrationBuilder.CreateIndex( - name: "IX_ItemDisplayPreferences_UserId", - schema: "jellyfin", - table: "ItemDisplayPreferences", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "HomeSection", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "ItemDisplayPreferences", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "DisplayPreferences", - schema: "jellyfin"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200905220533_FixDisplayPreferencesIndex.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20200905220533_FixDisplayPreferencesIndex.Designer.cs deleted file mode 100644 index 1134f7aa4..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200905220533_FixDisplayPreferencesIndex.Designer.cs +++ /dev/null @@ -1,461 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20200905220533_FixDisplayPreferencesIndex")] - partial class FixDisplayPreferencesIndex - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "3.1.7"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Overview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<string>("DashboardTheme") - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(64); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Permission_Permissions_Guid"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.HasKey("Id"); - - b.HasIndex("Preference_Preferences_Guid"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("DisplayPreferences") - .HasForeignKey("Jellyfin.Data.Entities.DisplayPreferences", "UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Guid"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20200905220533_FixDisplayPreferencesIndex.cs b/Jellyfin.Server.Implementations/Migrations/20200905220533_FixDisplayPreferencesIndex.cs deleted file mode 100644 index 91d2b190d..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20200905220533_FixDisplayPreferencesIndex.cs +++ /dev/null @@ -1,51 +0,0 @@ -#pragma warning disable CS1591 -#pragma warning disable SA1601 - -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class FixDisplayPreferencesIndex : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId_Client", - schema: "jellyfin", - table: "DisplayPreferences", - columns: new[] { "UserId", "Client" }, - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.DropIndex( - name: "IX_DisplayPreferences_UserId_Client", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences", - column: "UserId", - unique: true); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20201004171403_AddMaxActiveSessions.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20201004171403_AddMaxActiveSessions.Designer.cs deleted file mode 100644 index 607310caa..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20201004171403_AddMaxActiveSessions.Designer.cs +++ /dev/null @@ -1,464 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20201004171403_AddMaxActiveSessions")] - partial class AddMaxActiveSessions - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "3.1.8"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Overview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<string>("DashboardTheme") - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(512); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(32); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(64); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Permission_Permissions_Guid"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.HasKey("Id"); - - b.HasIndex("Preference_Preferences_Guid"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("DisplayPreferences") - .HasForeignKey("Jellyfin.Data.Entities.DisplayPreferences", "UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Guid"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20201004171403_AddMaxActiveSessions.cs b/Jellyfin.Server.Implementations/Migrations/20201004171403_AddMaxActiveSessions.cs deleted file mode 100644 index e37b4e696..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20201004171403_AddMaxActiveSessions.cs +++ /dev/null @@ -1,28 +0,0 @@ -#pragma warning disable CS1591 -#pragma warning disable SA1601 - -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddMaxActiveSessions : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn<int>( - name: "MaxActiveSessions", - schema: "jellyfin", - table: "Users", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "MaxActiveSessions", - schema: "jellyfin", - table: "Users"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20201204223655_AddCustomDisplayPreferences.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20201204223655_AddCustomDisplayPreferences.Designer.cs deleted file mode 100644 index 02c3fc753..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20201204223655_AddCustomDisplayPreferences.Designer.cs +++ /dev/null @@ -1,522 +0,0 @@ -#pragma warning disable CS1591 -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20201204223655_AddCustomDisplayPreferences")] - partial class AddCustomDisplayPreferences - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "5.0.0"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Permission_Permissions_Guid"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Preference_Preferences_Guid"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("DisplayPreferences") - .HasForeignKey("Jellyfin.Data.Entities.DisplayPreferences", "UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences") - .IsRequired(); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20201204223655_AddCustomDisplayPreferences.cs b/Jellyfin.Server.Implementations/Migrations/20201204223655_AddCustomDisplayPreferences.cs deleted file mode 100644 index ce2b21d0c..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20201204223655_AddCustomDisplayPreferences.cs +++ /dev/null @@ -1,108 +0,0 @@ -#pragma warning disable CS1591 -// <auto-generated /> -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddCustomDisplayPreferences : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_DisplayPreferences_UserId_Client", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.AlterColumn<int>( - name: "MaxActiveSessions", - schema: "jellyfin", - table: "Users", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AddColumn<Guid>( - name: "ItemId", - schema: "jellyfin", - table: "DisplayPreferences", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - migrationBuilder.CreateTable( - name: "CustomItemDisplayPreferences", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column<Guid>(type: "TEXT", nullable: false), - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - Client = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false), - Key = table.Column<string>(type: "TEXT", nullable: false), - Value = table.Column<string>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CustomItemDisplayPreferences", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId_ItemId_Client", - schema: "jellyfin", - table: "DisplayPreferences", - columns: new[] { "UserId", "ItemId", "Client" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_CustomItemDisplayPreferences_UserId", - schema: "jellyfin", - table: "CustomItemDisplayPreferences", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key", - schema: "jellyfin", - table: "CustomItemDisplayPreferences", - columns: new[] { "UserId", "ItemId", "Client", "Key" }, - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CustomItemDisplayPreferences", - schema: "jellyfin"); - - migrationBuilder.DropIndex( - name: "IX_DisplayPreferences_UserId_ItemId_Client", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.DropColumn( - name: "ItemId", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.AlterColumn<int>( - name: "MaxActiveSessions", - schema: "jellyfin", - table: "Users", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId_Client", - schema: "jellyfin", - table: "DisplayPreferences", - columns: new[] { "UserId", "Client" }, - unique: true); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20210320181425_AddIndexesAndCollations.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20210320181425_AddIndexesAndCollations.Designer.cs deleted file mode 100644 index 1cfd7112c..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20210320181425_AddIndexesAndCollations.Designer.cs +++ /dev/null @@ -1,535 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20210320181425_AddIndexesAndCollations")] - partial class AddIndexesAndCollations - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "5.0.3"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20210320181425_AddIndexesAndCollations.cs b/Jellyfin.Server.Implementations/Migrations/20210320181425_AddIndexesAndCollations.cs deleted file mode 100644 index 3acd5e7b5..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20210320181425_AddIndexesAndCollations.cs +++ /dev/null @@ -1,240 +0,0 @@ -#pragma warning disable CS1591 -#pragma warning disable SA1601 - -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddIndexesAndCollations : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ImageInfos_Users_UserId", - schema: "jellyfin", - table: "ImageInfos"); - - migrationBuilder.DropForeignKey( - name: "FK_Permissions_Users_Permission_Permissions_Guid", - schema: "jellyfin", - table: "Permissions"); - - migrationBuilder.DropForeignKey( - name: "FK_Preferences_Users_Preference_Preferences_Guid", - schema: "jellyfin", - table: "Preferences"); - - migrationBuilder.DropIndex( - name: "IX_Preferences_Preference_Preferences_Guid", - schema: "jellyfin", - table: "Preferences"); - - migrationBuilder.DropIndex( - name: "IX_Permissions_Permission_Permissions_Guid", - schema: "jellyfin", - table: "Permissions"); - - migrationBuilder.DropIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences"); - - migrationBuilder.DropIndex( - name: "IX_CustomItemDisplayPreferences_UserId", - schema: "jellyfin", - table: "CustomItemDisplayPreferences"); - - migrationBuilder.AlterColumn<string>( - name: "Username", - schema: "jellyfin", - table: "Users", - type: "TEXT", - maxLength: 255, - nullable: false, - collation: "NOCASE", - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 255); - - migrationBuilder.AddColumn<Guid>( - name: "UserId", - schema: "jellyfin", - table: "Preferences", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn<Guid>( - name: "UserId", - schema: "jellyfin", - table: "Permissions", - type: "TEXT", - nullable: true); - - migrationBuilder.Sql("UPDATE Preferences SET UserId = Preference_Preferences_Guid"); - migrationBuilder.Sql("UPDATE Permissions SET UserId = Permission_Permissions_Guid"); - - migrationBuilder.CreateIndex( - name: "IX_Users_Username", - schema: "jellyfin", - table: "Users", - column: "Username", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Preferences_UserId_Kind", - schema: "jellyfin", - table: "Preferences", - columns: new[] { "UserId", "Kind" }, - unique: true, - filter: "[UserId] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_Permissions_UserId_Kind", - schema: "jellyfin", - table: "Permissions", - columns: new[] { "UserId", "Kind" }, - unique: true, - filter: "[UserId] IS NOT NULL"); - - migrationBuilder.AddForeignKey( - name: "FK_ImageInfos_Users_UserId", - schema: "jellyfin", - table: "ImageInfos", - column: "UserId", - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Permissions_Users_UserId", - schema: "jellyfin", - table: "Permissions", - column: "UserId", - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Preferences_Users_UserId", - schema: "jellyfin", - table: "Preferences", - column: "UserId", - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ImageInfos_Users_UserId", - schema: "jellyfin", - table: "ImageInfos"); - - migrationBuilder.DropForeignKey( - name: "FK_Permissions_Users_UserId", - schema: "jellyfin", - table: "Permissions"); - - migrationBuilder.DropForeignKey( - name: "FK_Preferences_Users_UserId", - schema: "jellyfin", - table: "Preferences"); - - migrationBuilder.DropIndex( - name: "IX_Users_Username", - schema: "jellyfin", - table: "Users"); - - migrationBuilder.DropIndex( - name: "IX_Preferences_UserId_Kind", - schema: "jellyfin", - table: "Preferences"); - - migrationBuilder.DropIndex( - name: "IX_Permissions_UserId_Kind", - schema: "jellyfin", - table: "Permissions"); - - migrationBuilder.DropColumn( - name: "UserId", - schema: "jellyfin", - table: "Preferences"); - - migrationBuilder.DropColumn( - name: "UserId", - schema: "jellyfin", - table: "Permissions"); - - migrationBuilder.AlterColumn<string>( - name: "Username", - schema: "jellyfin", - table: "Users", - type: "TEXT", - maxLength: 255, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 255, - oldCollation: "NOCASE"); - - migrationBuilder.CreateIndex( - name: "IX_Preferences_Preference_Preferences_Guid", - schema: "jellyfin", - table: "Preferences", - column: "Preference_Preferences_Guid"); - - migrationBuilder.CreateIndex( - name: "IX_Permissions_Permission_Permissions_Guid", - schema: "jellyfin", - table: "Permissions", - column: "Permission_Permissions_Guid"); - - migrationBuilder.CreateIndex( - name: "IX_DisplayPreferences_UserId", - schema: "jellyfin", - table: "DisplayPreferences", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_CustomItemDisplayPreferences_UserId", - schema: "jellyfin", - table: "CustomItemDisplayPreferences", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_ImageInfos_Users_UserId", - schema: "jellyfin", - table: "ImageInfos", - column: "UserId", - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Permissions_Users_Permission_Permissions_Guid", - schema: "jellyfin", - table: "Permissions", - column: "Permission_Permissions_Guid", - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Preferences_Users_Preference_Preferences_Guid", - schema: "jellyfin", - table: "Preferences", - column: "Preference_Preferences_Guid", - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20210407110544_NullableCustomPrefValue.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20210407110544_NullableCustomPrefValue.Designer.cs deleted file mode 100644 index ecf7af495..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20210407110544_NullableCustomPrefValue.Designer.cs +++ /dev/null @@ -1,520 +0,0 @@ -#pragma warning disable CS1591 -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20210407110544_NullableCustomPrefValue")] - partial class NullableCustomPrefValue - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "5.0.3"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Permission_Permissions_Guid"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Preference_Preferences_Guid"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Guid"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20210407110544_NullableCustomPrefValue.cs b/Jellyfin.Server.Implementations/Migrations/20210407110544_NullableCustomPrefValue.cs deleted file mode 100644 index a6b169a61..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20210407110544_NullableCustomPrefValue.cs +++ /dev/null @@ -1,35 +0,0 @@ -#pragma warning disable CS1591 -// <auto-generated /> -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class NullableCustomPrefValue : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<string>( - name: "Value", - schema: "jellyfin", - table: "CustomItemDisplayPreferences", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<string>( - name: "Value", - schema: "jellyfin", - table: "CustomItemDisplayPreferences", - type: "TEXT", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20210814002109_AddDevices.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20210814002109_AddDevices.Designer.cs deleted file mode 100644 index dccba6f77..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20210814002109_AddDevices.Designer.cs +++ /dev/null @@ -1,653 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20210814002109_AddDevices")] - partial class AddDevices - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "5.0.7"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20210814002109_AddDevices.cs b/Jellyfin.Server.Implementations/Migrations/20210814002109_AddDevices.cs deleted file mode 100644 index bf90044cb..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20210814002109_AddDevices.cs +++ /dev/null @@ -1,128 +0,0 @@ -#pragma warning disable CS1591, SA1601 - -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddDevices : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ApiKeys", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false), - DateLastActivity = table.Column<DateTime>(type: "TEXT", nullable: false), - Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false), - AccessToken = table.Column<string>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiKeys", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "DeviceOptions", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DeviceId = table.Column<string>(type: "TEXT", nullable: false), - CustomName = table.Column<string>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DeviceOptions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Devices", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column<Guid>(type: "TEXT", nullable: false), - AccessToken = table.Column<string>(type: "TEXT", nullable: false), - AppName = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false), - AppVersion = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false), - DeviceName = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false), - DeviceId = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false), - IsActive = table.Column<bool>(type: "INTEGER", nullable: false), - DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false), - DateModified = table.Column<DateTime>(type: "TEXT", nullable: false), - DateLastActivity = table.Column<DateTime>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Devices", x => x.Id); - table.ForeignKey( - name: "FK_Devices_Users_UserId", - column: x => x.UserId, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ApiKeys_AccessToken", - schema: "jellyfin", - table: "ApiKeys", - column: "AccessToken", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_DeviceOptions_DeviceId", - schema: "jellyfin", - table: "DeviceOptions", - column: "DeviceId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Devices_AccessToken_DateLastActivity", - schema: "jellyfin", - table: "Devices", - columns: new[] { "AccessToken", "DateLastActivity" }); - - migrationBuilder.CreateIndex( - name: "IX_Devices_DeviceId", - schema: "jellyfin", - table: "Devices", - column: "DeviceId"); - - migrationBuilder.CreateIndex( - name: "IX_Devices_DeviceId_DateLastActivity", - schema: "jellyfin", - table: "Devices", - columns: new[] { "DeviceId", "DateLastActivity" }); - - migrationBuilder.CreateIndex( - name: "IX_Devices_UserId_DeviceId", - schema: "jellyfin", - table: "Devices", - columns: new[] { "UserId", "DeviceId" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ApiKeys", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "DeviceOptions", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "Devices", - schema: "jellyfin"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20221022080052_AddIndexActivityLogsDateCreated.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20221022080052_AddIndexActivityLogsDateCreated.Designer.cs deleted file mode 100644 index e821c106e..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20221022080052_AddIndexActivityLogsDateCreated.Designer.cs +++ /dev/null @@ -1,657 +0,0 @@ -#pragma warning disable CS1591 - -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20221022080052_AddIndexActivityLogsDateCreated")] - partial class AddIndexActivityLogsDateCreated - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("jellyfin") - .HasAnnotation("ProductVersion", "6.0.9"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<string>("EasyPassword") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users", "jellyfin"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20221022080052_AddIndexActivityLogsDateCreated.cs b/Jellyfin.Server.Implementations/Migrations/20221022080052_AddIndexActivityLogsDateCreated.cs deleted file mode 100644 index 9d5d7632b..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20221022080052_AddIndexActivityLogsDateCreated.cs +++ /dev/null @@ -1,28 +0,0 @@ -#pragma warning disable CS1591, SA1601 - -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - public partial class AddIndexActivityLogsDateCreated : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateIndex( - name: "IX_ActivityLogs_DateCreated", - schema: "jellyfin", - table: "ActivityLogs", - column: "DateCreated"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_ActivityLogs_DateCreated", - schema: "jellyfin", - table: "ActivityLogs"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20230526173516_RemoveEasyPassword.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20230526173516_RemoveEasyPassword.Designer.cs deleted file mode 100644 index 360fa0376..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20230526173516_RemoveEasyPassword.Designer.cs +++ /dev/null @@ -1,650 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20230526173516_RemoveEasyPassword")] - partial class RemoveEasyPassword - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.5"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20230526173516_RemoveEasyPassword.cs b/Jellyfin.Server.Implementations/Migrations/20230526173516_RemoveEasyPassword.cs deleted file mode 100644 index 354d91c38..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20230526173516_RemoveEasyPassword.cs +++ /dev/null @@ -1,164 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class RemoveEasyPassword : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "EasyPassword", - schema: "jellyfin", - table: "Users"); - - migrationBuilder.RenameTable( - name: "Users", - schema: "jellyfin", - newName: "Users"); - - migrationBuilder.RenameTable( - name: "Preferences", - schema: "jellyfin", - newName: "Preferences"); - - migrationBuilder.RenameTable( - name: "Permissions", - schema: "jellyfin", - newName: "Permissions"); - - migrationBuilder.RenameTable( - name: "ItemDisplayPreferences", - schema: "jellyfin", - newName: "ItemDisplayPreferences"); - - migrationBuilder.RenameTable( - name: "ImageInfos", - schema: "jellyfin", - newName: "ImageInfos"); - - migrationBuilder.RenameTable( - name: "HomeSection", - schema: "jellyfin", - newName: "HomeSection"); - - migrationBuilder.RenameTable( - name: "DisplayPreferences", - schema: "jellyfin", - newName: "DisplayPreferences"); - - migrationBuilder.RenameTable( - name: "Devices", - schema: "jellyfin", - newName: "Devices"); - - migrationBuilder.RenameTable( - name: "DeviceOptions", - schema: "jellyfin", - newName: "DeviceOptions"); - - migrationBuilder.RenameTable( - name: "CustomItemDisplayPreferences", - schema: "jellyfin", - newName: "CustomItemDisplayPreferences"); - - migrationBuilder.RenameTable( - name: "ApiKeys", - schema: "jellyfin", - newName: "ApiKeys"); - - migrationBuilder.RenameTable( - name: "ActivityLogs", - schema: "jellyfin", - newName: "ActivityLogs"); - - migrationBuilder.RenameTable( - name: "AccessSchedules", - schema: "jellyfin", - newName: "AccessSchedules"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "jellyfin"); - - migrationBuilder.RenameTable( - name: "Users", - newName: "Users", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "Preferences", - newName: "Preferences", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "Permissions", - newName: "Permissions", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "ItemDisplayPreferences", - newName: "ItemDisplayPreferences", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "ImageInfos", - newName: "ImageInfos", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "HomeSection", - newName: "HomeSection", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "DisplayPreferences", - newName: "DisplayPreferences", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "Devices", - newName: "Devices", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "DeviceOptions", - newName: "DeviceOptions", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "CustomItemDisplayPreferences", - newName: "CustomItemDisplayPreferences", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "ApiKeys", - newName: "ApiKeys", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "ActivityLogs", - newName: "ActivityLogs", - newSchema: "jellyfin"); - - migrationBuilder.RenameTable( - name: "AccessSchedules", - newName: "AccessSchedules", - newSchema: "jellyfin"); - - migrationBuilder.AddColumn<string>( - name: "EasyPassword", - schema: "jellyfin", - table: "Users", - type: "TEXT", - maxLength: 65535, - nullable: true); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20230626233818_AddTrickplayInfos.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20230626233818_AddTrickplayInfos.Designer.cs deleted file mode 100644 index 17d33845f..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20230626233818_AddTrickplayInfos.Designer.cs +++ /dev/null @@ -1,681 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20230626233818_AddTrickplayInfos")] - partial class AddTrickplayInfos - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.7"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20230626233818_AddTrickplayInfos.cs b/Jellyfin.Server.Implementations/Migrations/20230626233818_AddTrickplayInfos.cs deleted file mode 100644 index 85f1b5b7d..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20230626233818_AddTrickplayInfos.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class AddTrickplayInfos : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "TrickplayInfos", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - Width = table.Column<int>(type: "INTEGER", nullable: false), - Height = table.Column<int>(type: "INTEGER", nullable: false), - TileWidth = table.Column<int>(type: "INTEGER", nullable: false), - TileHeight = table.Column<int>(type: "INTEGER", nullable: false), - ThumbnailCount = table.Column<int>(type: "INTEGER", nullable: false), - Interval = table.Column<int>(type: "INTEGER", nullable: false), - Bandwidth = table.Column<int>(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TrickplayInfos", x => new { x.ItemId, x.Width }); - }); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TrickplayInfos"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20230923170422_UserCastReceiver.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20230923170422_UserCastReceiver.Designer.cs deleted file mode 100644 index 4c0917669..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20230923170422_UserCastReceiver.Designer.cs +++ /dev/null @@ -1,654 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20230923170422_UserCastReceiver")] - partial class UserCastReceiver - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.11"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20230923170422_UserCastReceiver.cs b/Jellyfin.Server.Implementations/Migrations/20230923170422_UserCastReceiver.cs deleted file mode 100644 index 5919e4665..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20230923170422_UserCastReceiver.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class UserCastReceiver : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn<string>( - name: "CastReceiverId", - table: "Users", - type: "TEXT", - maxLength: 32, - nullable: true); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CastReceiverId", - table: "Users"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20240729140605_AddMediaSegments.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20240729140605_AddMediaSegments.Designer.cs deleted file mode 100644 index 35a3cdad2..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20240729140605_AddMediaSegments.Designer.cs +++ /dev/null @@ -1,708 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20240729140605_AddMediaSegments")] - partial class AddMediaSegments - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.7"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20240729140605_AddMediaSegments.cs b/Jellyfin.Server.Implementations/Migrations/20240729140605_AddMediaSegments.cs deleted file mode 100644 index 18164d999..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20240729140605_AddMediaSegments.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class AddMediaSegments : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "MediaSegments", - columns: table => new - { - Id = table.Column<Guid>(type: "TEXT", nullable: false), - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - Type = table.Column<int>(type: "INTEGER", nullable: false), - EndTicks = table.Column<long>(type: "INTEGER", nullable: false), - StartTicks = table.Column<long>(type: "INTEGER", nullable: false), - SegmentProviderId = table.Column<string>(type: "TEXT", nullable: false), - }, - constraints: table => - { - table.PrimaryKey("PK_MediaSegments", x => x.Id); - }); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "MediaSegments"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20240928082930_MarkSegmentProviderIdNonNullable.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20240928082930_MarkSegmentProviderIdNonNullable.Designer.cs deleted file mode 100644 index 8dba31a67..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20240928082930_MarkSegmentProviderIdNonNullable.Designer.cs +++ /dev/null @@ -1,712 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20240928082930_MarkSegmentProviderIdNonNullable")] - partial class MarkSegmentProviderIdNonNullable - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.8"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20240928082930_MarkSegmentProviderIdNonNullable.cs b/Jellyfin.Server.Implementations/Migrations/20240928082930_MarkSegmentProviderIdNonNullable.cs deleted file mode 100644 index 55b90a54d..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20240928082930_MarkSegmentProviderIdNonNullable.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class MarkSegmentProviderIdNonNullable : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<string>( - name: "SegmentProviderId", - table: "MediaSegments", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<string>( - name: "SegmentProviderId", - table: "MediaSegments", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241020103111_LibraryDbMigration.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241020103111_LibraryDbMigration.Designer.cs deleted file mode 100644 index 27745f601..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241020103111_LibraryDbMigration.Designer.cs +++ /dev/null @@ -1,1607 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241020103111_LibraryDbMigration")] - partial class LibraryDbMigration - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("BaseItemEntityId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("BaseItemEntityId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue"); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", null) - .WithMany("AncestorIds") - .HasForeignKey("BaseItemEntityId"); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany() - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("AncestorIds"); - - b.Navigation("Chapters"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241020103111_LibraryDbMigration.cs b/Jellyfin.Server.Implementations/Migrations/20241020103111_LibraryDbMigration.cs deleted file mode 100644 index 8cc7fb452..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241020103111_LibraryDbMigration.cs +++ /dev/null @@ -1,639 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class LibraryDbMigration : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "BaseItems", - columns: table => new - { - Id = table.Column<Guid>(type: "TEXT", nullable: false), - Type = table.Column<string>(type: "TEXT", nullable: false), - Data = table.Column<string>(type: "TEXT", nullable: true), - Path = table.Column<string>(type: "TEXT", nullable: true), - StartDate = table.Column<DateTime>(type: "TEXT", nullable: false), - EndDate = table.Column<DateTime>(type: "TEXT", nullable: false), - ChannelId = table.Column<string>(type: "TEXT", nullable: true), - IsMovie = table.Column<bool>(type: "INTEGER", nullable: false), - CommunityRating = table.Column<float>(type: "REAL", nullable: true), - CustomRating = table.Column<string>(type: "TEXT", nullable: true), - IndexNumber = table.Column<int>(type: "INTEGER", nullable: true), - IsLocked = table.Column<bool>(type: "INTEGER", nullable: false), - Name = table.Column<string>(type: "TEXT", nullable: true), - OfficialRating = table.Column<string>(type: "TEXT", nullable: true), - MediaType = table.Column<string>(type: "TEXT", nullable: true), - Overview = table.Column<string>(type: "TEXT", nullable: true), - ParentIndexNumber = table.Column<int>(type: "INTEGER", nullable: true), - PremiereDate = table.Column<DateTime>(type: "TEXT", nullable: true), - ProductionYear = table.Column<int>(type: "INTEGER", nullable: true), - Genres = table.Column<string>(type: "TEXT", nullable: true), - SortName = table.Column<string>(type: "TEXT", nullable: true), - ForcedSortName = table.Column<string>(type: "TEXT", nullable: true), - RunTimeTicks = table.Column<long>(type: "INTEGER", nullable: true), - DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true), - DateModified = table.Column<DateTime>(type: "TEXT", nullable: true), - IsSeries = table.Column<bool>(type: "INTEGER", nullable: false), - EpisodeTitle = table.Column<string>(type: "TEXT", nullable: true), - IsRepeat = table.Column<bool>(type: "INTEGER", nullable: false), - PreferredMetadataLanguage = table.Column<string>(type: "TEXT", nullable: true), - PreferredMetadataCountryCode = table.Column<string>(type: "TEXT", nullable: true), - DateLastRefreshed = table.Column<DateTime>(type: "TEXT", nullable: true), - DateLastSaved = table.Column<DateTime>(type: "TEXT", nullable: true), - IsInMixedFolder = table.Column<bool>(type: "INTEGER", nullable: false), - Studios = table.Column<string>(type: "TEXT", nullable: true), - ExternalServiceId = table.Column<string>(type: "TEXT", nullable: true), - Tags = table.Column<string>(type: "TEXT", nullable: true), - IsFolder = table.Column<bool>(type: "INTEGER", nullable: false), - InheritedParentalRatingValue = table.Column<int>(type: "INTEGER", nullable: true), - UnratedType = table.Column<string>(type: "TEXT", nullable: true), - CriticRating = table.Column<float>(type: "REAL", nullable: true), - CleanName = table.Column<string>(type: "TEXT", nullable: true), - PresentationUniqueKey = table.Column<string>(type: "TEXT", nullable: true), - OriginalTitle = table.Column<string>(type: "TEXT", nullable: true), - PrimaryVersionId = table.Column<string>(type: "TEXT", nullable: true), - DateLastMediaAdded = table.Column<DateTime>(type: "TEXT", nullable: true), - Album = table.Column<string>(type: "TEXT", nullable: true), - LUFS = table.Column<float>(type: "REAL", nullable: true), - NormalizationGain = table.Column<float>(type: "REAL", nullable: true), - IsVirtualItem = table.Column<bool>(type: "INTEGER", nullable: false), - SeriesName = table.Column<string>(type: "TEXT", nullable: true), - SeasonName = table.Column<string>(type: "TEXT", nullable: true), - ExternalSeriesId = table.Column<string>(type: "TEXT", nullable: true), - Tagline = table.Column<string>(type: "TEXT", nullable: true), - ProductionLocations = table.Column<string>(type: "TEXT", nullable: true), - ExtraIds = table.Column<string>(type: "TEXT", nullable: true), - TotalBitrate = table.Column<int>(type: "INTEGER", nullable: true), - ExtraType = table.Column<int>(type: "INTEGER", nullable: true), - Artists = table.Column<string>(type: "TEXT", nullable: true), - AlbumArtists = table.Column<string>(type: "TEXT", nullable: true), - ExternalId = table.Column<string>(type: "TEXT", nullable: true), - SeriesPresentationUniqueKey = table.Column<string>(type: "TEXT", nullable: true), - ShowId = table.Column<string>(type: "TEXT", nullable: true), - OwnerId = table.Column<string>(type: "TEXT", nullable: true), - Width = table.Column<int>(type: "INTEGER", nullable: true), - Height = table.Column<int>(type: "INTEGER", nullable: true), - Size = table.Column<long>(type: "INTEGER", nullable: true), - Audio = table.Column<int>(type: "INTEGER", nullable: true), - ParentId = table.Column<Guid>(type: "TEXT", nullable: true), - TopParentId = table.Column<Guid>(type: "TEXT", nullable: true), - SeasonId = table.Column<Guid>(type: "TEXT", nullable: true), - SeriesId = table.Column<Guid>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BaseItems", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ItemValues", - columns: table => new - { - ItemValueId = table.Column<Guid>(type: "TEXT", nullable: false), - Type = table.Column<int>(type: "INTEGER", nullable: false), - Value = table.Column<string>(type: "TEXT", nullable: false), - CleanValue = table.Column<string>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ItemValues", x => x.ItemValueId); - }); - - migrationBuilder.CreateTable( - name: "Peoples", - columns: table => new - { - Id = table.Column<Guid>(type: "TEXT", nullable: false), - Name = table.Column<string>(type: "TEXT", nullable: false), - PersonType = table.Column<string>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Peoples", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AncestorIds", - columns: table => new - { - ParentItemId = table.Column<Guid>(type: "TEXT", nullable: false), - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - BaseItemEntityId = table.Column<Guid>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AncestorIds", x => new { x.ItemId, x.ParentItemId }); - table.ForeignKey( - name: "FK_AncestorIds_BaseItems_BaseItemEntityId", - column: x => x.BaseItemEntityId, - principalTable: "BaseItems", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_AncestorIds_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AncestorIds_BaseItems_ParentItemId", - column: x => x.ParentItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AttachmentStreamInfos", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - Index = table.Column<int>(type: "INTEGER", nullable: false), - Codec = table.Column<string>(type: "TEXT", nullable: false), - CodecTag = table.Column<string>(type: "TEXT", nullable: true), - Comment = table.Column<string>(type: "TEXT", nullable: true), - Filename = table.Column<string>(type: "TEXT", nullable: true), - MimeType = table.Column<string>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AttachmentStreamInfos", x => new { x.ItemId, x.Index }); - table.ForeignKey( - name: "FK_AttachmentStreamInfos_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "BaseItemImageInfos", - columns: table => new - { - Id = table.Column<Guid>(type: "TEXT", nullable: false), - Path = table.Column<string>(type: "TEXT", nullable: false), - DateModified = table.Column<DateTime>(type: "TEXT", nullable: false), - ImageType = table.Column<int>(type: "INTEGER", nullable: false), - Width = table.Column<int>(type: "INTEGER", nullable: false), - Height = table.Column<int>(type: "INTEGER", nullable: false), - Blurhash = table.Column<byte[]>(type: "BLOB", nullable: true), - ItemId = table.Column<Guid>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BaseItemImageInfos", x => x.Id); - table.ForeignKey( - name: "FK_BaseItemImageInfos_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "BaseItemMetadataFields", - columns: table => new - { - Id = table.Column<int>(type: "INTEGER", nullable: false), - ItemId = table.Column<Guid>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BaseItemMetadataFields", x => new { x.Id, x.ItemId }); - table.ForeignKey( - name: "FK_BaseItemMetadataFields_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "BaseItemProviders", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - ProviderId = table.Column<string>(type: "TEXT", nullable: false), - ProviderValue = table.Column<string>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BaseItemProviders", x => new { x.ItemId, x.ProviderId }); - table.ForeignKey( - name: "FK_BaseItemProviders_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "BaseItemTrailerTypes", - columns: table => new - { - Id = table.Column<int>(type: "INTEGER", nullable: false), - ItemId = table.Column<Guid>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BaseItemTrailerTypes", x => new { x.Id, x.ItemId }); - table.ForeignKey( - name: "FK_BaseItemTrailerTypes_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Chapters", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - ChapterIndex = table.Column<int>(type: "INTEGER", nullable: false), - StartPositionTicks = table.Column<long>(type: "INTEGER", nullable: false), - Name = table.Column<string>(type: "TEXT", nullable: true), - ImagePath = table.Column<string>(type: "TEXT", nullable: true), - ImageDateModified = table.Column<DateTime>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Chapters", x => new { x.ItemId, x.ChapterIndex }); - table.ForeignKey( - name: "FK_Chapters_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "MediaStreamInfos", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - StreamIndex = table.Column<int>(type: "INTEGER", nullable: false), - StreamType = table.Column<int>(type: "INTEGER", nullable: true), - Codec = table.Column<string>(type: "TEXT", nullable: true), - Language = table.Column<string>(type: "TEXT", nullable: true), - ChannelLayout = table.Column<string>(type: "TEXT", nullable: true), - Profile = table.Column<string>(type: "TEXT", nullable: true), - AspectRatio = table.Column<string>(type: "TEXT", nullable: true), - Path = table.Column<string>(type: "TEXT", nullable: true), - IsInterlaced = table.Column<bool>(type: "INTEGER", nullable: false), - BitRate = table.Column<int>(type: "INTEGER", nullable: false), - Channels = table.Column<int>(type: "INTEGER", nullable: false), - SampleRate = table.Column<int>(type: "INTEGER", nullable: false), - IsDefault = table.Column<bool>(type: "INTEGER", nullable: false), - IsForced = table.Column<bool>(type: "INTEGER", nullable: false), - IsExternal = table.Column<bool>(type: "INTEGER", nullable: false), - Height = table.Column<int>(type: "INTEGER", nullable: false), - Width = table.Column<int>(type: "INTEGER", nullable: false), - AverageFrameRate = table.Column<float>(type: "REAL", nullable: false), - RealFrameRate = table.Column<float>(type: "REAL", nullable: false), - Level = table.Column<float>(type: "REAL", nullable: false), - PixelFormat = table.Column<string>(type: "TEXT", nullable: true), - BitDepth = table.Column<int>(type: "INTEGER", nullable: false), - IsAnamorphic = table.Column<bool>(type: "INTEGER", nullable: false), - RefFrames = table.Column<int>(type: "INTEGER", nullable: false), - CodecTag = table.Column<string>(type: "TEXT", nullable: false), - Comment = table.Column<string>(type: "TEXT", nullable: false), - NalLengthSize = table.Column<string>(type: "TEXT", nullable: false), - IsAvc = table.Column<bool>(type: "INTEGER", nullable: false), - Title = table.Column<string>(type: "TEXT", nullable: false), - TimeBase = table.Column<string>(type: "TEXT", nullable: false), - CodecTimeBase = table.Column<string>(type: "TEXT", nullable: false), - ColorPrimaries = table.Column<string>(type: "TEXT", nullable: false), - ColorSpace = table.Column<string>(type: "TEXT", nullable: false), - ColorTransfer = table.Column<string>(type: "TEXT", nullable: false), - DvVersionMajor = table.Column<int>(type: "INTEGER", nullable: false), - DvVersionMinor = table.Column<int>(type: "INTEGER", nullable: false), - DvProfile = table.Column<int>(type: "INTEGER", nullable: false), - DvLevel = table.Column<int>(type: "INTEGER", nullable: false), - RpuPresentFlag = table.Column<int>(type: "INTEGER", nullable: false), - ElPresentFlag = table.Column<int>(type: "INTEGER", nullable: false), - BlPresentFlag = table.Column<int>(type: "INTEGER", nullable: false), - DvBlSignalCompatibilityId = table.Column<int>(type: "INTEGER", nullable: false), - IsHearingImpaired = table.Column<bool>(type: "INTEGER", nullable: false), - Rotation = table.Column<int>(type: "INTEGER", nullable: false), - KeyFrames = table.Column<string>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_MediaStreamInfos", x => new { x.ItemId, x.StreamIndex }); - table.ForeignKey( - name: "FK_MediaStreamInfos_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserData", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - UserId = table.Column<Guid>(type: "TEXT", nullable: false), - Rating = table.Column<double>(type: "REAL", nullable: true), - PlaybackPositionTicks = table.Column<long>(type: "INTEGER", nullable: false), - PlayCount = table.Column<int>(type: "INTEGER", nullable: false), - IsFavorite = table.Column<bool>(type: "INTEGER", nullable: false), - LastPlayedDate = table.Column<DateTime>(type: "TEXT", nullable: true), - Played = table.Column<bool>(type: "INTEGER", nullable: false), - AudioStreamIndex = table.Column<int>(type: "INTEGER", nullable: true), - SubtitleStreamIndex = table.Column<int>(type: "INTEGER", nullable: true), - Likes = table.Column<bool>(type: "INTEGER", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_UserData", x => new { x.ItemId, x.UserId }); - table.ForeignKey( - name: "FK_UserData_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_UserData_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ItemValuesMap", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - ItemValueId = table.Column<Guid>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ItemValuesMap", x => new { x.ItemValueId, x.ItemId }); - table.ForeignKey( - name: "FK_ItemValuesMap_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ItemValuesMap_ItemValues_ItemValueId", - column: x => x.ItemValueId, - principalTable: "ItemValues", - principalColumn: "ItemValueId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "PeopleBaseItemMap", - columns: table => new - { - ItemId = table.Column<Guid>(type: "TEXT", nullable: false), - PeopleId = table.Column<Guid>(type: "TEXT", nullable: false), - SortOrder = table.Column<int>(type: "INTEGER", nullable: true), - ListOrder = table.Column<int>(type: "INTEGER", nullable: true), - Role = table.Column<string>(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PeopleBaseItemMap", x => new { x.ItemId, x.PeopleId }); - table.ForeignKey( - name: "FK_PeopleBaseItemMap_BaseItems_ItemId", - column: x => x.ItemId, - principalTable: "BaseItems", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_PeopleBaseItemMap_Peoples_PeopleId", - column: x => x.PeopleId, - principalTable: "Peoples", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AncestorIds_BaseItemEntityId", - table: "AncestorIds", - column: "BaseItemEntityId"); - - migrationBuilder.CreateIndex( - name: "IX_AncestorIds_ParentItemId", - table: "AncestorIds", - column: "ParentItemId"); - - migrationBuilder.CreateIndex( - name: "IX_BaseItemImageInfos_ItemId", - table: "BaseItemImageInfos", - column: "ItemId"); - - migrationBuilder.CreateIndex( - name: "IX_BaseItemMetadataFields_ItemId", - table: "BaseItemMetadataFields", - column: "ItemId"); - - migrationBuilder.CreateIndex( - name: "IX_BaseItemProviders_ProviderId_ProviderValue_ItemId", - table: "BaseItemProviders", - columns: new[] { "ProviderId", "ProviderValue", "ItemId" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Id_Type_IsFolder_IsVirtualItem", - table: "BaseItems", - columns: new[] { "Id", "Type", "IsFolder", "IsVirtualItem" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_IsFolder_TopParentId_IsVirtualItem_PresentationUniqueKey_DateCreated", - table: "BaseItems", - columns: new[] { "IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_MediaType_TopParentId_IsVirtualItem_PresentationUniqueKey", - table: "BaseItems", - columns: new[] { "MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_ParentId", - table: "BaseItems", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Path", - table: "BaseItems", - column: "Path"); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_PresentationUniqueKey", - table: "BaseItems", - column: "PresentationUniqueKey"); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_TopParentId_Id", - table: "BaseItems", - columns: new[] { "TopParentId", "Id" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Type_SeriesPresentationUniqueKey_IsFolder_IsVirtualItem", - table: "BaseItems", - columns: new[] { "Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Type_SeriesPresentationUniqueKey_PresentationUniqueKey_SortName", - table: "BaseItems", - columns: new[] { "Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Type_TopParentId_Id", - table: "BaseItems", - columns: new[] { "Type", "TopParentId", "Id" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Type_TopParentId_IsVirtualItem_PresentationUniqueKey_DateCreated", - table: "BaseItems", - columns: new[] { "Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Type_TopParentId_PresentationUniqueKey", - table: "BaseItems", - columns: new[] { "Type", "TopParentId", "PresentationUniqueKey" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItems_Type_TopParentId_StartDate", - table: "BaseItems", - columns: new[] { "Type", "TopParentId", "StartDate" }); - - migrationBuilder.CreateIndex( - name: "IX_BaseItemTrailerTypes_ItemId", - table: "BaseItemTrailerTypes", - column: "ItemId"); - - migrationBuilder.CreateIndex( - name: "IX_ItemValues_Type_CleanValue", - table: "ItemValues", - columns: new[] { "Type", "CleanValue" }); - - migrationBuilder.CreateIndex( - name: "IX_ItemValuesMap_ItemId", - table: "ItemValuesMap", - column: "ItemId"); - - migrationBuilder.CreateIndex( - name: "IX_MediaStreamInfos_StreamIndex", - table: "MediaStreamInfos", - column: "StreamIndex"); - - migrationBuilder.CreateIndex( - name: "IX_MediaStreamInfos_StreamIndex_StreamType", - table: "MediaStreamInfos", - columns: new[] { "StreamIndex", "StreamType" }); - - migrationBuilder.CreateIndex( - name: "IX_MediaStreamInfos_StreamIndex_StreamType_Language", - table: "MediaStreamInfos", - columns: new[] { "StreamIndex", "StreamType", "Language" }); - - migrationBuilder.CreateIndex( - name: "IX_MediaStreamInfos_StreamType", - table: "MediaStreamInfos", - column: "StreamType"); - - migrationBuilder.CreateIndex( - name: "IX_PeopleBaseItemMap_ItemId_ListOrder", - table: "PeopleBaseItemMap", - columns: new[] { "ItemId", "ListOrder" }); - - migrationBuilder.CreateIndex( - name: "IX_PeopleBaseItemMap_ItemId_SortOrder", - table: "PeopleBaseItemMap", - columns: new[] { "ItemId", "SortOrder" }); - - migrationBuilder.CreateIndex( - name: "IX_PeopleBaseItemMap_PeopleId", - table: "PeopleBaseItemMap", - column: "PeopleId"); - - migrationBuilder.CreateIndex( - name: "IX_Peoples_Name", - table: "Peoples", - column: "Name"); - - migrationBuilder.CreateIndex( - name: "IX_UserData_ItemId_UserId_IsFavorite", - table: "UserData", - columns: new[] { "ItemId", "UserId", "IsFavorite" }); - - migrationBuilder.CreateIndex( - name: "IX_UserData_ItemId_UserId_LastPlayedDate", - table: "UserData", - columns: new[] { "ItemId", "UserId", "LastPlayedDate" }); - - migrationBuilder.CreateIndex( - name: "IX_UserData_ItemId_UserId_PlaybackPositionTicks", - table: "UserData", - columns: new[] { "ItemId", "UserId", "PlaybackPositionTicks" }); - - migrationBuilder.CreateIndex( - name: "IX_UserData_ItemId_UserId_Played", - table: "UserData", - columns: new[] { "ItemId", "UserId", "Played" }); - - migrationBuilder.CreateIndex( - name: "IX_UserData_UserId", - table: "UserData", - column: "UserId"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AncestorIds"); - - migrationBuilder.DropTable( - name: "AttachmentStreamInfos"); - - migrationBuilder.DropTable( - name: "BaseItemImageInfos"); - - migrationBuilder.DropTable( - name: "BaseItemMetadataFields"); - - migrationBuilder.DropTable( - name: "BaseItemProviders"); - - migrationBuilder.DropTable( - name: "BaseItemTrailerTypes"); - - migrationBuilder.DropTable( - name: "Chapters"); - - migrationBuilder.DropTable( - name: "ItemValuesMap"); - - migrationBuilder.DropTable( - name: "MediaStreamInfos"); - - migrationBuilder.DropTable( - name: "PeopleBaseItemMap"); - - migrationBuilder.DropTable( - name: "UserData"); - - migrationBuilder.DropTable( - name: "ItemValues"); - - migrationBuilder.DropTable( - name: "Peoples"); - - migrationBuilder.DropTable( - name: "BaseItems"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241111131257_AddedCustomDataKey.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241111131257_AddedCustomDataKey.Designer.cs deleted file mode 100644 index 1fbf21492..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241111131257_AddedCustomDataKey.Designer.cs +++ /dev/null @@ -1,1610 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241111131257_AddedCustomDataKey")] - partial class AddedCustomDataKey - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("BaseItemEntityId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("BaseItemEntityId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue"); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", null) - .WithMany("AncestorIds") - .HasForeignKey("BaseItemEntityId"); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany() - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("AncestorIds"); - - b.Navigation("Chapters"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241111131257_AddedCustomDataKey.cs b/Jellyfin.Server.Implementations/Migrations/20241111131257_AddedCustomDataKey.cs deleted file mode 100644 index ac78019ed..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241111131257_AddedCustomDataKey.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class AddedCustomDataKey : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn<string>( - name: "CustomDataKey", - table: "UserData", - type: "TEXT", - nullable: true); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CustomDataKey", - table: "UserData"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241111135439_AddedCustomDataKeyKey.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241111135439_AddedCustomDataKeyKey.Designer.cs deleted file mode 100644 index bac6fd5b5..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241111135439_AddedCustomDataKeyKey.Designer.cs +++ /dev/null @@ -1,1610 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241111135439_AddedCustomDataKeyKey")] - partial class AddedCustomDataKeyKey - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("BaseItemEntityId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("BaseItemEntityId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue"); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", null) - .WithMany("AncestorIds") - .HasForeignKey("BaseItemEntityId"); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany() - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("AncestorIds"); - - b.Navigation("Chapters"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241111135439_AddedCustomDataKeyKey.cs b/Jellyfin.Server.Implementations/Migrations/20241111135439_AddedCustomDataKeyKey.cs deleted file mode 100644 index 4558d7c49..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241111135439_AddedCustomDataKeyKey.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class AddedCustomDataKeyKey : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_UserData", - table: "UserData"); - - migrationBuilder.AlterColumn<string>( - name: "CustomDataKey", - table: "UserData", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserData", - table: "UserData", - columns: new[] { "ItemId", "UserId", "CustomDataKey" }); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_UserData", - table: "UserData"); - - migrationBuilder.AlterColumn<string>( - name: "CustomDataKey", - table: "UserData", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserData", - table: "UserData", - columns: new[] { "ItemId", "UserId" }); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241112152323_FixAncestorIdConfig.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241112152323_FixAncestorIdConfig.Designer.cs deleted file mode 100644 index ad622d44c..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241112152323_FixAncestorIdConfig.Designer.cs +++ /dev/null @@ -1,1603 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241112152323_FixAncestorIdConfig")] - partial class FixAncestorIdConfig - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue"); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241112152323_FixAncestorIdConfig.cs b/Jellyfin.Server.Implementations/Migrations/20241112152323_FixAncestorIdConfig.cs deleted file mode 100644 index 70e81f367..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241112152323_FixAncestorIdConfig.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class FixAncestorIdConfig : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AncestorIds_BaseItems_BaseItemEntityId", - table: "AncestorIds"); - - migrationBuilder.DropIndex( - name: "IX_AncestorIds_BaseItemEntityId", - table: "AncestorIds"); - - migrationBuilder.DropColumn( - name: "BaseItemEntityId", - table: "AncestorIds"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn<Guid>( - name: "BaseItemEntityId", - table: "AncestorIds", - type: "TEXT", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_AncestorIds_BaseItemEntityId", - table: "AncestorIds", - column: "BaseItemEntityId"); - - migrationBuilder.AddForeignKey( - name: "FK_AncestorIds_BaseItems_BaseItemEntityId", - table: "AncestorIds", - column: "BaseItemEntityId", - principalTable: "BaseItems", - principalColumn: "Id"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241112232041_fixMediaStreams.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241112232041_fixMediaStreams.Designer.cs deleted file mode 100644 index dc4c8212b..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241112232041_fixMediaStreams.Designer.cs +++ /dev/null @@ -1,1600 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241112232041_FixMediaStreams")] - partial class FixMediaStreams - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue"); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<float?>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int?>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int?>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<int?>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int?>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<float?>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<float?>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int?>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int?>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241112232041_fixMediaStreams.cs b/Jellyfin.Server.Implementations/Migrations/20241112232041_fixMediaStreams.cs deleted file mode 100644 index d57ea81b3..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241112232041_fixMediaStreams.cs +++ /dev/null @@ -1,702 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class FixMediaStreams : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<int>( - name: "Width", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<string>( - name: "Title", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "TimeBase", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<int>( - name: "StreamType", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "SampleRate", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "RpuPresentFlag", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "Rotation", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "RefFrames", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<float>( - name: "RealFrameRate", - table: "MediaStreamInfos", - type: "REAL", - nullable: true, - oldClrType: typeof(float), - oldType: "REAL"); - - migrationBuilder.AlterColumn<string>( - name: "Profile", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Path", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "NalLengthSize", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<float>( - name: "Level", - table: "MediaStreamInfos", - type: "REAL", - nullable: true, - oldClrType: typeof(float), - oldType: "REAL"); - - migrationBuilder.AlterColumn<string>( - name: "Language", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<bool>( - name: "IsHearingImpaired", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<bool>( - name: "IsAvc", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<bool>( - name: "IsAnamorphic", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "Height", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "ElPresentFlag", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "DvVersionMinor", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "DvVersionMajor", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "DvProfile", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "DvLevel", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "DvBlSignalCompatibilityId", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<string>( - name: "Comment", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "ColorTransfer", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "ColorSpace", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "ColorPrimaries", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "CodecTimeBase", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "CodecTag", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "Codec", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "Channels", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<string>( - name: "ChannelLayout", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "BlPresentFlag", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "BitRate", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "BitDepth", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<float>( - name: "AverageFrameRate", - table: "MediaStreamInfos", - type: "REAL", - nullable: true, - oldClrType: typeof(float), - oldType: "REAL"); - - migrationBuilder.AlterColumn<string>( - name: "AspectRatio", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<int>( - name: "Width", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Title", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "TimeBase", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "StreamType", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<int>( - name: "SampleRate", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "RpuPresentFlag", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "Rotation", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "RefFrames", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<float>( - name: "RealFrameRate", - table: "MediaStreamInfos", - type: "REAL", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "REAL", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Profile", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "Path", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "NalLengthSize", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<float>( - name: "Level", - table: "MediaStreamInfos", - type: "REAL", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "REAL", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Language", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<bool>( - name: "IsHearingImpaired", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: false, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<bool>( - name: "IsAvc", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: false, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<bool>( - name: "IsAnamorphic", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: false, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "Height", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "ElPresentFlag", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "DvVersionMinor", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "DvVersionMajor", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "DvProfile", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "DvLevel", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "DvBlSignalCompatibilityId", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Comment", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "ColorTransfer", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "ColorSpace", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "ColorPrimaries", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "CodecTimeBase", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "CodecTag", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Codec", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<int>( - name: "Channels", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "ChannelLayout", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<int>( - name: "BlPresentFlag", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "BitRate", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<int>( - name: "BitDepth", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<float>( - name: "AverageFrameRate", - table: "MediaStreamInfos", - type: "REAL", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "REAL", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "AspectRatio", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241112234144_FixMediaStreams2.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241112234144_FixMediaStreams2.Designer.cs deleted file mode 100644 index 5714120b5..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241112234144_FixMediaStreams2.Designer.cs +++ /dev/null @@ -1,1594 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241112234144_FixMediaStreams2")] - partial class FixMediaStreams2 - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue"); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float?>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int?>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int?>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<int?>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int?>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float?>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float?>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int?>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int?>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241112234144_FixMediaStreams2.cs b/Jellyfin.Server.Implementations/Migrations/20241112234144_FixMediaStreams2.cs deleted file mode 100644 index 78611b9e4..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241112234144_FixMediaStreams2.cs +++ /dev/null @@ -1,144 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class FixMediaStreams2 : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<string>( - name: "Profile", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "Path", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "Language", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<bool>( - name: "IsInterlaced", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: true, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn<string>( - name: "Codec", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "ChannelLayout", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<string>( - name: "AspectRatio", - table: "MediaStreamInfos", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<string>( - name: "Profile", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Path", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Language", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<bool>( - name: "IsInterlaced", - table: "MediaStreamInfos", - type: "INTEGER", - nullable: false, - defaultValue: false, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "Codec", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "ChannelLayout", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<string>( - name: "AspectRatio", - table: "MediaStreamInfos", - type: "TEXT", - nullable: false, - defaultValue: string.Empty, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241113133548_EnforceUniqueItemValue.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241113133548_EnforceUniqueItemValue.Designer.cs deleted file mode 100644 index 855f02fd3..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241113133548_EnforceUniqueItemValue.Designer.cs +++ /dev/null @@ -1,1595 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20241113133548_EnforceUniqueItemValue")] - partial class EnforceUniqueItemValue - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue") - .IsUnique(); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float?>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int?>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int?>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<int?>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int?>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float?>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float?>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int?>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int?>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20241113133548_EnforceUniqueItemValue.cs b/Jellyfin.Server.Implementations/Migrations/20241113133548_EnforceUniqueItemValue.cs deleted file mode 100644 index d1b06ceae..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20241113133548_EnforceUniqueItemValue.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class EnforceUniqueItemValue : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_ItemValues_Type_CleanValue", - table: "ItemValues"); - - migrationBuilder.CreateIndex( - name: "IX_ItemValues_Type_CleanValue", - table: "ItemValues", - columns: new[] { "Type", "CleanValue" }, - unique: true); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_ItemValues_Type_CleanValue", - table: "ItemValues"); - - migrationBuilder.CreateIndex( - name: "IX_ItemValues_Type_CleanValue", - table: "ItemValues", - columns: new[] { "Type", "CleanValue" }); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20250204092455_MakeStartEndDateNullable.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20250204092455_MakeStartEndDateNullable.Designer.cs deleted file mode 100644 index a329f1ef1..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20250204092455_MakeStartEndDateNullable.Designer.cs +++ /dev/null @@ -1,1595 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20250204092455_MakeStartEndDateNullable")] - partial class MakeStartEndDateNullable - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.1"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue") - .IsUnique(); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float?>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int?>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int?>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<int?>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int?>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float?>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float?>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int?>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int?>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20250204092455_MakeStartEndDateNullable.cs b/Jellyfin.Server.Implementations/Migrations/20250204092455_MakeStartEndDateNullable.cs deleted file mode 100644 index 2c60dd7a6..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20250204092455_MakeStartEndDateNullable.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class MakeStartEndDateNullable : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<DateTime>( - name: "StartDate", - table: "BaseItems", - type: "TEXT", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "TEXT"); - - migrationBuilder.AlterColumn<DateTime>( - name: "EndDate", - table: "BaseItems", - type: "TEXT", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "TEXT"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn<DateTime>( - name: "StartDate", - table: "BaseItems", - type: "TEXT", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn<DateTime>( - name: "EndDate", - table: "BaseItems", - type: "TEXT", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "TEXT", - oldNullable: true); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.Designer.cs deleted file mode 100644 index 48919c9b5..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.Designer.cs +++ /dev/null @@ -1,1595 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - [Migration("20250214031148_ChannelIdGuid")] - partial class ChannelIdGuid - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.2"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue") - .IsUnique(); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float?>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int?>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int?>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<int?>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int?>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float?>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float?>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int?>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int?>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.cs b/Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.cs deleted file mode 100644 index 1e904e833..000000000 --- a/Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <inheritdoc /> - public partial class ChannelIdGuid : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - // NOOP, Guids and strings are stored the same in SQLite. - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - // NOOP, Guids and strings are stored the same in SQLite. - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/DesignTimeJellyfinDbFactory.cs b/Jellyfin.Server.Implementations/Migrations/DesignTimeJellyfinDbFactory.cs deleted file mode 100644 index 500c4a1c7..000000000 --- a/Jellyfin.Server.Implementations/Migrations/DesignTimeJellyfinDbFactory.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; -using Microsoft.Extensions.Logging.Abstractions; - -namespace Jellyfin.Server.Implementations.Migrations -{ - /// <summary> - /// The design time factory for <see cref="JellyfinDbContext"/>. - /// This is only used for the creation of migrations and not during runtime. - /// </summary> - internal class DesignTimeJellyfinDbFactory : IDesignTimeDbContextFactory<JellyfinDbContext> - { - public JellyfinDbContext CreateDbContext(string[] args) - { - var optionsBuilder = new DbContextOptionsBuilder<JellyfinDbContext>(); - optionsBuilder.UseSqlite("Data Source=jellyfin.db"); - - return new JellyfinDbContext(optionsBuilder.Options, NullLogger<JellyfinDbContext>.Instance); - } - } -} diff --git a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs deleted file mode 100644 index fef122886..000000000 --- a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs +++ /dev/null @@ -1,1592 +0,0 @@ -// <auto-generated /> -using System; -using Jellyfin.Server.Implementations; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Jellyfin.Server.Implementations.Migrations -{ - [DbContext(typeof(JellyfinDbContext))] - partial class JellyfinDbModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.2"); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DayOfWeek") - .HasColumnType("INTEGER"); - - b.Property<double>("EndHour") - .HasColumnType("REAL"); - - b.Property<double>("StartHour") - .HasColumnType("REAL"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AccessSchedules"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<string>("ItemId") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<int>("LogSeverity") - .HasColumnType("INTEGER"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("ShortOverview") - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<string>("Type") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DateCreated"); - - b.ToTable("ActivityLogs"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ParentItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ParentItemId"); - - b.HasIndex("ParentItemId"); - - b.ToTable("AncestorIds"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Index") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "Index"); - - b.ToTable("AttachmentStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Album") - .HasColumnType("TEXT"); - - b.Property<string>("AlbumArtists") - .HasColumnType("TEXT"); - - b.Property<string>("Artists") - .HasColumnType("TEXT"); - - b.Property<int?>("Audio") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("ChannelId") - .HasColumnType("TEXT"); - - b.Property<string>("CleanName") - .HasColumnType("TEXT"); - - b.Property<float?>("CommunityRating") - .HasColumnType("REAL"); - - b.Property<float?>("CriticRating") - .HasColumnType("REAL"); - - b.Property<string>("CustomRating") - .HasColumnType("TEXT"); - - b.Property<string>("Data") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastMediaAdded") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastRefreshed") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateLastSaved") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("DateModified") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("EndDate") - .HasColumnType("TEXT"); - - b.Property<string>("EpisodeTitle") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalSeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("ExternalServiceId") - .HasColumnType("TEXT"); - - b.Property<string>("ExtraIds") - .HasColumnType("TEXT"); - - b.Property<int?>("ExtraType") - .HasColumnType("INTEGER"); - - b.Property<string>("ForcedSortName") - .HasColumnType("TEXT"); - - b.Property<string>("Genres") - .HasColumnType("TEXT"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexNumber") - .HasColumnType("INTEGER"); - - b.Property<int?>("InheritedParentalRatingValue") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsInMixedFolder") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsLocked") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsMovie") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsRepeat") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsSeries") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsVirtualItem") - .HasColumnType("INTEGER"); - - b.Property<float?>("LUFS") - .HasColumnType("REAL"); - - b.Property<string>("MediaType") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<float?>("NormalizationGain") - .HasColumnType("REAL"); - - b.Property<string>("OfficialRating") - .HasColumnType("TEXT"); - - b.Property<string>("OriginalTitle") - .HasColumnType("TEXT"); - - b.Property<string>("Overview") - .HasColumnType("TEXT"); - - b.Property<string>("OwnerId") - .HasColumnType("TEXT"); - - b.Property<Guid?>("ParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("ParentIndexNumber") - .HasColumnType("INTEGER"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataCountryCode") - .HasColumnType("TEXT"); - - b.Property<string>("PreferredMetadataLanguage") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("PremiereDate") - .HasColumnType("TEXT"); - - b.Property<string>("PresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("PrimaryVersionId") - .HasColumnType("TEXT"); - - b.Property<string>("ProductionLocations") - .HasColumnType("TEXT"); - - b.Property<int?>("ProductionYear") - .HasColumnType("INTEGER"); - - b.Property<long?>("RunTimeTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("SeasonId") - .HasColumnType("TEXT"); - - b.Property<string>("SeasonName") - .HasColumnType("TEXT"); - - b.Property<Guid?>("SeriesId") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesName") - .HasColumnType("TEXT"); - - b.Property<string>("SeriesPresentationUniqueKey") - .HasColumnType("TEXT"); - - b.Property<string>("ShowId") - .HasColumnType("TEXT"); - - b.Property<long?>("Size") - .HasColumnType("INTEGER"); - - b.Property<string>("SortName") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("StartDate") - .HasColumnType("TEXT"); - - b.Property<string>("Studios") - .HasColumnType("TEXT"); - - b.Property<string>("Tagline") - .HasColumnType("TEXT"); - - b.Property<string>("Tags") - .HasColumnType("TEXT"); - - b.Property<Guid?>("TopParentId") - .HasColumnType("TEXT"); - - b.Property<int?>("TotalBitrate") - .HasColumnType("INTEGER"); - - b.Property<string>("Type") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("UnratedType") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("Path"); - - b.HasIndex("PresentationUniqueKey"); - - b.HasIndex("TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "Id"); - - b.HasIndex("Type", "TopParentId", "PresentationUniqueKey"); - - b.HasIndex("Type", "TopParentId", "StartDate"); - - b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem"); - - b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); - - b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated"); - - b.ToTable("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<byte[]>("Blurhash") - .HasColumnType("BLOB"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("ImageType") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemMetadataFields"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderId") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemId", "ProviderId"); - - b.HasIndex("ProviderId", "ProviderValue", "ItemId"); - - b.ToTable("BaseItemProviders"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.Property<int>("Id") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("Id", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("BaseItemTrailerTypes"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ChapterIndex") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("ImageDateModified") - .HasColumnType("TEXT"); - - b.Property<string>("ImagePath") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .HasColumnType("TEXT"); - - b.Property<long>("StartPositionTicks") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "ChapterIndex"); - - b.ToTable("Chapters"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("Key") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client", "Key") - .IsUnique(); - - b.ToTable("CustomItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("ChromecastVersion") - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<string>("DashboardTheme") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("EnableNextVideoInfoOverlay") - .HasColumnType("INTEGER"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("ScrollDirection") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowBackdrop") - .HasColumnType("INTEGER"); - - b.Property<bool>("ShowSidebar") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipBackwardLength") - .HasColumnType("INTEGER"); - - b.Property<int>("SkipForwardLength") - .HasColumnType("INTEGER"); - - b.Property<string>("TvHome") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "ItemId", "Client") - .IsUnique(); - - b.ToTable("DisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("DisplayPreferencesId") - .HasColumnType("INTEGER"); - - b.Property<int>("Order") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("DisplayPreferencesId"); - - b.ToTable("HomeSection"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime>("LastModified") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.ToTable("ImageInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("Client") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<int?>("IndexBy") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<bool>("RememberIndexing") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSorting") - .HasColumnType("INTEGER"); - - b.Property<string>("SortBy") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<int>("SortOrder") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<int>("ViewType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("ItemDisplayPreferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Property<Guid>("ItemValueId") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("CleanValue") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.Property<string>("Value") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId"); - - b.HasIndex("Type", "CleanValue") - .IsUnique(); - - b.ToTable("ItemValues"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.Property<Guid>("ItemValueId") - .HasColumnType("TEXT"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.HasKey("ItemValueId", "ItemId"); - - b.HasIndex("ItemId"); - - b.ToTable("ItemValuesMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<long>("EndTicks") - .HasColumnType("INTEGER"); - - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<string>("SegmentProviderId") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<long>("StartTicks") - .HasColumnType("INTEGER"); - - b.Property<int>("Type") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MediaSegments"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("StreamIndex") - .HasColumnType("INTEGER"); - - b.Property<string>("AspectRatio") - .HasColumnType("TEXT"); - - b.Property<float?>("AverageFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("BitDepth") - .HasColumnType("INTEGER"); - - b.Property<int?>("BitRate") - .HasColumnType("INTEGER"); - - b.Property<int?>("BlPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<string>("ChannelLayout") - .HasColumnType("TEXT"); - - b.Property<int?>("Channels") - .HasColumnType("INTEGER"); - - b.Property<string>("Codec") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTag") - .HasColumnType("TEXT"); - - b.Property<string>("CodecTimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("ColorPrimaries") - .HasColumnType("TEXT"); - - b.Property<string>("ColorSpace") - .HasColumnType("TEXT"); - - b.Property<string>("ColorTransfer") - .HasColumnType("TEXT"); - - b.Property<string>("Comment") - .HasColumnType("TEXT"); - - b.Property<int?>("DvBlSignalCompatibilityId") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvLevel") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvProfile") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMajor") - .HasColumnType("INTEGER"); - - b.Property<int?>("DvVersionMinor") - .HasColumnType("INTEGER"); - - b.Property<int?>("ElPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("Height") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAnamorphic") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsAvc") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsDefault") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsExternal") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsForced") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsHearingImpaired") - .HasColumnType("INTEGER"); - - b.Property<bool?>("IsInterlaced") - .HasColumnType("INTEGER"); - - b.Property<string>("KeyFrames") - .HasColumnType("TEXT"); - - b.Property<string>("Language") - .HasColumnType("TEXT"); - - b.Property<float?>("Level") - .HasColumnType("REAL"); - - b.Property<string>("NalLengthSize") - .HasColumnType("TEXT"); - - b.Property<string>("Path") - .HasColumnType("TEXT"); - - b.Property<string>("PixelFormat") - .HasColumnType("TEXT"); - - b.Property<string>("Profile") - .HasColumnType("TEXT"); - - b.Property<float?>("RealFrameRate") - .HasColumnType("REAL"); - - b.Property<int?>("RefFrames") - .HasColumnType("INTEGER"); - - b.Property<int?>("Rotation") - .HasColumnType("INTEGER"); - - b.Property<int?>("RpuPresentFlag") - .HasColumnType("INTEGER"); - - b.Property<int?>("SampleRate") - .HasColumnType("INTEGER"); - - b.Property<int>("StreamType") - .HasColumnType("INTEGER"); - - b.Property<string>("TimeBase") - .HasColumnType("TEXT"); - - b.Property<string>("Title") - .HasColumnType("TEXT"); - - b.Property<int?>("Width") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "StreamIndex"); - - b.HasIndex("StreamIndex"); - - b.HasIndex("StreamType"); - - b.HasIndex("StreamIndex", "StreamType"); - - b.HasIndex("StreamIndex", "StreamType", "Language"); - - b.ToTable("MediaStreamInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("PersonType") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("Peoples"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("PeopleId") - .HasColumnType("TEXT"); - - b.Property<int?>("ListOrder") - .HasColumnType("INTEGER"); - - b.Property<string>("Role") - .HasColumnType("TEXT"); - - b.Property<int?>("SortOrder") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "PeopleId"); - - b.HasIndex("PeopleId"); - - b.HasIndex("ItemId", "ListOrder"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("PeopleBaseItemMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Permission_Permissions_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<bool>("Value") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Permissions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<int>("Kind") - .HasColumnType("INTEGER"); - - b.Property<Guid?>("Preference_Preferences_Guid") - .HasColumnType("TEXT"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<Guid?>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("Value") - .IsRequired() - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "Kind") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("Preferences"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AccessToken") - .IsUnique(); - - b.ToTable("ApiKeys"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("AccessToken") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("AppName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<string>("AppVersion") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateCreated") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateLastActivity") - .HasColumnType("TEXT"); - - b.Property<DateTime>("DateModified") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property<string>("DeviceName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); - - b.Property<bool>("IsActive") - .HasColumnType("INTEGER"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId"); - - b.HasIndex("AccessToken", "DateLastActivity"); - - b.HasIndex("DeviceId", "DateLastActivity"); - - b.HasIndex("UserId", "DeviceId"); - - b.ToTable("Devices"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("CustomName") - .HasColumnType("TEXT"); - - b.Property<string>("DeviceId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceOptions"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<int>("Width") - .HasColumnType("INTEGER"); - - b.Property<int>("Bandwidth") - .HasColumnType("INTEGER"); - - b.Property<int>("Height") - .HasColumnType("INTEGER"); - - b.Property<int>("Interval") - .HasColumnType("INTEGER"); - - b.Property<int>("ThumbnailCount") - .HasColumnType("INTEGER"); - - b.Property<int>("TileHeight") - .HasColumnType("INTEGER"); - - b.Property<int>("TileWidth") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "Width"); - - b.ToTable("TrickplayInfos"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<string>("AudioLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("AuthenticationProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<string>("CastReceiverId") - .HasMaxLength(32) - .HasColumnType("TEXT"); - - b.Property<bool>("DisplayCollectionsView") - .HasColumnType("INTEGER"); - - b.Property<bool>("DisplayMissingEpisodes") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableAutoLogin") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableLocalPassword") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableNextEpisodeAutoPlay") - .HasColumnType("INTEGER"); - - b.Property<bool>("EnableUserPreferenceAccess") - .HasColumnType("INTEGER"); - - b.Property<bool>("HidePlayedInLatest") - .HasColumnType("INTEGER"); - - b.Property<long>("InternalId") - .HasColumnType("INTEGER"); - - b.Property<int>("InvalidLoginAttemptCount") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastActivityDate") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastLoginDate") - .HasColumnType("TEXT"); - - b.Property<int?>("LoginAttemptsBeforeLockout") - .HasColumnType("INTEGER"); - - b.Property<int>("MaxActiveSessions") - .HasColumnType("INTEGER"); - - b.Property<int?>("MaxParentalAgeRating") - .HasColumnType("INTEGER"); - - b.Property<bool>("MustUpdatePassword") - .HasColumnType("INTEGER"); - - b.Property<string>("Password") - .HasMaxLength(65535) - .HasColumnType("TEXT"); - - b.Property<string>("PasswordResetProviderId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<bool>("PlayDefaultAudioTrack") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberAudioSelections") - .HasColumnType("INTEGER"); - - b.Property<bool>("RememberSubtitleSelections") - .HasColumnType("INTEGER"); - - b.Property<int?>("RemoteClientBitrateLimit") - .HasColumnType("INTEGER"); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.Property<string>("SubtitleLanguagePreference") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property<int>("SubtitleMode") - .HasColumnType("INTEGER"); - - b.Property<int>("SyncPlayAccess") - .HasColumnType("INTEGER"); - - b.Property<string>("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT") - .UseCollation("NOCASE"); - - b.HasKey("Id"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.Property<Guid>("ItemId") - .HasColumnType("TEXT"); - - b.Property<Guid>("UserId") - .HasColumnType("TEXT"); - - b.Property<string>("CustomDataKey") - .HasColumnType("TEXT"); - - b.Property<int?>("AudioStreamIndex") - .HasColumnType("INTEGER"); - - b.Property<bool>("IsFavorite") - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("LastPlayedDate") - .HasColumnType("TEXT"); - - b.Property<bool?>("Likes") - .HasColumnType("INTEGER"); - - b.Property<int>("PlayCount") - .HasColumnType("INTEGER"); - - b.Property<long>("PlaybackPositionTicks") - .HasColumnType("INTEGER"); - - b.Property<bool>("Played") - .HasColumnType("INTEGER"); - - b.Property<double?>("Rating") - .HasColumnType("REAL"); - - b.Property<int?>("SubtitleStreamIndex") - .HasColumnType("INTEGER"); - - b.HasKey("ItemId", "UserId", "CustomDataKey"); - - b.HasIndex("UserId"); - - b.HasIndex("ItemId", "UserId", "IsFavorite"); - - b.HasIndex("ItemId", "UserId", "LastPlayedDate"); - - b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks"); - - b.HasIndex("ItemId", "UserId", "Played"); - - b.ToTable("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("AccessSchedules") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Children") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "ParentItem") - .WithMany("ParentAncestors") - .HasForeignKey("ParentItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ParentItem"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Images") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemMetadataField", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("LockedFields") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Provider") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemTrailerType", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("TrailerTypes") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Chapters") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("DisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b => - { - b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null) - .WithMany("HomeSections") - .HasForeignKey("DisplayPreferencesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithOne("ProfileImage") - .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ItemDisplayPreferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValueMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("ItemValues") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.ItemValue", "ItemValue") - .WithMany("BaseItemsMap") - .HasForeignKey("ItemValueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("ItemValue"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("MediaStreams") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.PeopleBaseItemMap", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("Peoples") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.People", "People") - .WithMany("BaseItems") - .HasForeignKey("PeopleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("People"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Permissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Preferences") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b => - { - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b => - { - b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item") - .WithMany("UserData") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Jellyfin.Data.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b => - { - b.Navigation("Chapters"); - - b.Navigation("Children"); - - b.Navigation("Images"); - - b.Navigation("ItemValues"); - - b.Navigation("LockedFields"); - - b.Navigation("MediaStreams"); - - b.Navigation("ParentAncestors"); - - b.Navigation("Peoples"); - - b.Navigation("Provider"); - - b.Navigation("TrailerTypes"); - - b.Navigation("UserData"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b => - { - b.Navigation("HomeSections"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b => - { - b.Navigation("BaseItemsMap"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.People", b => - { - b.Navigation("BaseItems"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => - { - b.Navigation("AccessSchedules"); - - b.Navigation("DisplayPreferences"); - - b.Navigation("ItemDisplayPreferences"); - - b.Navigation("Permissions"); - - b.Navigation("Preferences"); - - b.Navigation("ProfileImage"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelBuilderExtensions.cs b/Jellyfin.Server.Implementations/ModelBuilderExtensions.cs deleted file mode 100644 index 79ae1661a..000000000 --- a/Jellyfin.Server.Implementations/ModelBuilderExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using Jellyfin.Server.Implementations.ValueConverters; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations -{ - /// <summary> - /// Model builder extensions. - /// </summary> - public static class ModelBuilderExtensions - { - /// <summary> - /// Specify value converter for the object type. - /// </summary> - /// <param name="modelBuilder">The model builder.</param> - /// <param name="converter">The <see cref="ValueConverter{TModel,TProvider}"/>.</param> - /// <typeparam name="T">The type to convert.</typeparam> - /// <returns>The modified <see cref="ModelBuilder"/>.</returns> - public static ModelBuilder UseValueConverterForType<T>(this ModelBuilder modelBuilder, ValueConverter converter) - { - var type = typeof(T); - foreach (var entityType in modelBuilder.Model.GetEntityTypes()) - { - foreach (var property in entityType.GetProperties()) - { - if (property.ClrType == type) - { - property.SetValueConverter(converter); - } - } - } - - return modelBuilder; - } - - /// <summary> - /// Specify the default <see cref="DateTimeKind"/>. - /// </summary> - /// <param name="modelBuilder">The model builder to extend.</param> - /// <param name="kind">The <see cref="DateTimeKind"/> to specify.</param> - public static void SetDefaultDateTimeKind(this ModelBuilder modelBuilder, DateTimeKind kind) - { - modelBuilder.UseValueConverterForType<DateTime>(new DateTimeKindValueConverter(kind)); - modelBuilder.UseValueConverterForType<DateTime?>(new DateTimeKindValueConverter(kind)); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ActivityLogConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ActivityLogConfiguration.cs deleted file mode 100644 index 9a63ed9f2..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ActivityLogConfiguration.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// FluentAPI configuration for the ActivityLog entity. -/// </summary> -public class ActivityLogConfiguration : IEntityTypeConfiguration<ActivityLog> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ActivityLog> builder) - { - builder.HasIndex(entity => entity.DateCreated); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/AncestorIdConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/AncestorIdConfiguration.cs deleted file mode 100644 index 8cc817fb8..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/AncestorIdConfiguration.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// AncestorId configuration. -/// </summary> -public class AncestorIdConfiguration : IEntityTypeConfiguration<AncestorId> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<AncestorId> builder) - { - builder.HasKey(e => new { e.ItemId, e.ParentItemId }); - builder.HasIndex(e => e.ParentItemId); - builder.HasOne(e => e.ParentItem).WithMany(e => e.ParentAncestors).HasForeignKey(f => f.ParentItemId); - builder.HasOne(e => e.Item).WithMany(e => e.Children).HasForeignKey(f => f.ItemId); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs deleted file mode 100644 index 3f19b6986..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ApiKeyConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Jellyfin.Data.Entities.Security; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the ApiKey entity. - /// </summary> - public class ApiKeyConfiguration : IEntityTypeConfiguration<ApiKey> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ApiKey> builder) - { - builder - .HasIndex(entity => entity.AccessToken) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs deleted file mode 100644 index 057b6689a..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// FluentAPI configuration for the AttachmentStreamInfo entity. -/// </summary> -public class AttachmentStreamInfoConfiguration : IEntityTypeConfiguration<AttachmentStreamInfo> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<AttachmentStreamInfo> builder) - { - builder.HasKey(e => new { e.ItemId, e.Index }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs deleted file mode 100644 index eaf48981c..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using SQLitePCL; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Configuration for BaseItem. -/// </summary> -public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemEntity> builder) - { - builder.HasKey(e => e.Id); - // TODO: See rant in entity file. - // builder.HasOne(e => e.Parent).WithMany(e => e.DirectChildren).HasForeignKey(e => e.ParentId); - // builder.HasOne(e => e.TopParent).WithMany(e => e.AllChildren).HasForeignKey(e => e.TopParentId); - // builder.HasOne(e => e.Season).WithMany(e => e.SeasonEpisodes).HasForeignKey(e => e.SeasonId); - // builder.HasOne(e => e.Series).WithMany(e => e.SeriesEpisodes).HasForeignKey(e => e.SeriesId); - builder.HasMany(e => e.Peoples); - builder.HasMany(e => e.UserData); - builder.HasMany(e => e.ItemValues); - builder.HasMany(e => e.MediaStreams); - builder.HasMany(e => e.Chapters); - builder.HasMany(e => e.Provider); - builder.HasMany(e => e.ParentAncestors); - builder.HasMany(e => e.Children); - builder.HasMany(e => e.LockedFields); - builder.HasMany(e => e.TrailerTypes); - builder.HasMany(e => e.Images); - - builder.HasIndex(e => e.Path); - builder.HasIndex(e => e.ParentId); - builder.HasIndex(e => e.PresentationUniqueKey); - builder.HasIndex(e => new { e.Id, e.Type, e.IsFolder, e.IsVirtualItem }); - - // covering index - builder.HasIndex(e => new { e.TopParentId, e.Id }); - // series - builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.PresentationUniqueKey, e.SortName }); - // series counts - // seriesdateplayed sort order - builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.IsFolder, e.IsVirtualItem }); - // live tv programs - builder.HasIndex(e => new { e.Type, e.TopParentId, e.StartDate }); - // covering index for getitemvalues - builder.HasIndex(e => new { e.Type, e.TopParentId, e.Id }); - // used by movie suggestions - builder.HasIndex(e => new { e.Type, e.TopParentId, e.PresentationUniqueKey }); - // latest items - builder.HasIndex(e => new { e.Type, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated }); - builder.HasIndex(e => new { e.IsFolder, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated }); - // resume - builder.HasIndex(e => new { e.MediaType, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemMetadataFieldConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemMetadataFieldConfiguration.cs deleted file mode 100644 index 137f4a883..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemMetadataFieldConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Linq; -using Jellyfin.Data.Entities; -using MediaBrowser.Model.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using SQLitePCL; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Provides configuration for the BaseItemMetadataField entity. -/// </summary> -public class BaseItemMetadataFieldConfiguration : IEntityTypeConfiguration<BaseItemMetadataField> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemMetadataField> builder) - { - builder.HasKey(e => new { e.Id, e.ItemId }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemProviderConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemProviderConfiguration.cs deleted file mode 100644 index d15049a1f..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemProviderConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// BaseItemProvider configuration. -/// </summary> -public class BaseItemProviderConfiguration : IEntityTypeConfiguration<BaseItemProvider> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemProvider> builder) - { - builder.HasKey(e => new { e.ItemId, e.ProviderId }); - builder.HasOne(e => e.Item); - builder.HasIndex(e => new { e.ProviderId, e.ProviderValue, e.ItemId }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemTrailerTypeConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemTrailerTypeConfiguration.cs deleted file mode 100644 index f03d99c29..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemTrailerTypeConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Linq; -using Jellyfin.Data.Entities; -using MediaBrowser.Model.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using SQLitePCL; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Provides configuration for the BaseItemMetadataField entity. -/// </summary> -public class BaseItemTrailerTypeConfiguration : IEntityTypeConfiguration<BaseItemTrailerType> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<BaseItemTrailerType> builder) - { - builder.HasKey(e => new { e.Id, e.ItemId }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs deleted file mode 100644 index 5a84f7750..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// Chapter configuration. -/// </summary> -public class ChapterConfiguration : IEntityTypeConfiguration<Chapter> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Chapter> builder) - { - builder.HasKey(e => new { e.ItemId, e.ChapterIndex }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/CustomItemDisplayPreferencesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/CustomItemDisplayPreferencesConfiguration.cs deleted file mode 100644 index 779aec986..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/CustomItemDisplayPreferencesConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the CustomItemDisplayPreferences entity. - /// </summary> - public class CustomItemDisplayPreferencesConfiguration : IEntityTypeConfiguration<CustomItemDisplayPreferences> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<CustomItemDisplayPreferences> builder) - { - builder - .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client, entity.Key }) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs deleted file mode 100644 index a750b65c0..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceConfiguration.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Jellyfin.Data.Entities.Security; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the Device entity. - /// </summary> - public class DeviceConfiguration : IEntityTypeConfiguration<Device> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Device> builder) - { - builder - .HasIndex(entity => new { entity.DeviceId, entity.DateLastActivity }); - - builder - .HasIndex(entity => new { entity.AccessToken, entity.DateLastActivity }); - - builder - .HasIndex(entity => new { entity.UserId, entity.DeviceId }); - - builder - .HasIndex(entity => entity.DeviceId); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceOptionsConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DeviceOptionsConfiguration.cs deleted file mode 100644 index 038afd752..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/DeviceOptionsConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Jellyfin.Data.Entities.Security; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the DeviceOptions entity. - /// </summary> - public class DeviceOptionsConfiguration : IEntityTypeConfiguration<DeviceOptions> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<DeviceOptions> builder) - { - builder - .HasIndex(entity => entity.DeviceId) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs deleted file mode 100644 index 9b437861b..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the DisplayPreferencesConfiguration entity. - /// </summary> - public class DisplayPreferencesConfiguration : IEntityTypeConfiguration<DisplayPreferences> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<DisplayPreferences> builder) - { - builder - .HasMany(d => d.HomeSections) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client }) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs deleted file mode 100644 index abeeb09c9..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// itemvalues Configuration. -/// </summary> -public class ItemValuesConfiguration : IEntityTypeConfiguration<ItemValue> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ItemValue> builder) - { - builder.HasKey(e => e.ItemValueId); - builder.HasIndex(e => new { e.Type, e.CleanValue }).IsUnique(); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesMapConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesMapConfiguration.cs deleted file mode 100644 index 9c22b114c..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesMapConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// itemvalues Configuration. -/// </summary> -public class ItemValuesMapConfiguration : IEntityTypeConfiguration<ItemValueMap> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<ItemValueMap> builder) - { - builder.HasKey(e => new { e.ItemValueId, e.ItemId }); - builder.HasOne(e => e.Item); - builder.HasOne(e => e.ItemValue); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs deleted file mode 100644 index 7e572f9a3..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// People configuration. -/// </summary> -public class MediaStreamInfoConfiguration : IEntityTypeConfiguration<MediaStreamInfo> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<MediaStreamInfo> builder) - { - builder.HasKey(e => new { e.ItemId, e.StreamIndex }); - builder.HasIndex(e => e.StreamIndex); - builder.HasIndex(e => e.StreamType); - builder.HasIndex(e => new { e.StreamIndex, e.StreamType }); - builder.HasIndex(e => new { e.StreamIndex, e.StreamType, e.Language }); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleBaseItemMapConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PeopleBaseItemMapConfiguration.cs deleted file mode 100644 index cdaee9161..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleBaseItemMapConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// People configuration. -/// </summary> -public class PeopleBaseItemMapConfiguration : IEntityTypeConfiguration<PeopleBaseItemMap> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<PeopleBaseItemMap> builder) - { - builder.HasKey(e => new { e.ItemId, e.PeopleId }); - builder.HasIndex(e => new { e.ItemId, e.SortOrder }); - builder.HasIndex(e => new { e.ItemId, e.ListOrder }); - builder.HasOne(e => e.Item); - builder.HasOne(e => e.People); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs deleted file mode 100644 index f3cccb13f..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration; - -/// <summary> -/// People configuration. -/// </summary> -public class PeopleConfiguration : IEntityTypeConfiguration<People> -{ - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<People> builder) - { - builder.HasKey(e => e.Id); - builder.HasIndex(e => e.Name); - builder.HasMany(e => e.BaseItems); - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PermissionConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PermissionConfiguration.cs deleted file mode 100644 index 240e284c0..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PermissionConfiguration.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the Permission entity. - /// </summary> - public class PermissionConfiguration : IEntityTypeConfiguration<Permission> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Permission> builder) - { - // Used to get a user's permissions or a specific permission for a user. - // Also prevents multiple values being created for a user. - // Filtered over non-null user ids for when other entities (groups, API keys) get permissions - builder - .HasIndex(p => new { p.UserId, p.Kind }) - .HasFilter("[UserId] IS NOT NULL") - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PreferenceConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PreferenceConfiguration.cs deleted file mode 100644 index 49c869c6a..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/PreferenceConfiguration.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the Permission entity. - /// </summary> - public class PreferenceConfiguration : IEntityTypeConfiguration<Preference> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<Preference> builder) - { - builder - .HasIndex(p => new { p.UserId, p.Kind }) - .HasFilter("[UserId] IS NOT NULL") - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/TrickplayInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/TrickplayInfoConfiguration.cs deleted file mode 100644 index dc1c17e5e..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/TrickplayInfoConfiguration.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the TrickplayInfo entity. - /// </summary> - public class TrickplayInfoConfiguration : IEntityTypeConfiguration<TrickplayInfo> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<TrickplayInfo> builder) - { - builder.HasKey(info => new { info.ItemId, info.Width }); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/UserConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/UserConfiguration.cs deleted file mode 100644 index a369cf656..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/UserConfiguration.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Jellyfin.Data.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Jellyfin.Server.Implementations.ModelConfiguration -{ - /// <summary> - /// FluentAPI configuration for the User entity. - /// </summary> - public class UserConfiguration : IEntityTypeConfiguration<User> - { - /// <inheritdoc/> - public void Configure(EntityTypeBuilder<User> builder) - { - builder - .Property(user => user.Username) - .UseCollation("NOCASE"); - - builder - .HasOne(u => u.ProfileImage) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.Permissions) - .WithOne() - .HasForeignKey(p => p.UserId) - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.Preferences) - .WithOne() - .HasForeignKey(p => p.UserId) - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.AccessSchedules) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.DisplayPreferences) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasMany(u => u.ItemDisplayPreferences) - .WithOne() - .OnDelete(DeleteBehavior.Cascade); - - builder - .HasIndex(entity => entity.Username) - .IsUnique(); - } - } -} diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs deleted file mode 100644 index 7bbb28d43..000000000 --- a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs +++ /dev/null @@ -1,23 +0,0 @@ -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.ItemId, d.UserId, d.CustomDataKey }); - builder.HasIndex(d => new { d.ItemId, d.UserId, d.Played }); - builder.HasIndex(d => new { d.ItemId, d.UserId, d.PlaybackPositionTicks }); - builder.HasIndex(d => new { d.ItemId, d.UserId, d.IsFavorite }); - builder.HasIndex(d => new { d.ItemId, d.UserId, d.LastPlayedDate }); - builder.HasOne(e => e.Item); - } -} diff --git a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs index 1c9f54ab0..cf0293463 100644 --- a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs +++ b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Jellyfin.Data.Entities.Security; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities.Security; using MediaBrowser.Controller.Security; using Microsoft.EntityFrameworkCore; diff --git a/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs b/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs index 9e225393c..e3fe517c4 100644 --- a/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs +++ b/Jellyfin.Server.Implementations/Security/AuthorizationContext.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Net; using System.Threading.Tasks; using Jellyfin.Data.Queries; +using Jellyfin.Database.Implementations; using Jellyfin.Extensions; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; diff --git a/Jellyfin.Server.Implementations/StorageHelpers/StorageHelper.cs b/Jellyfin.Server.Implementations/StorageHelpers/StorageHelper.cs new file mode 100644 index 000000000..b2f54be7e --- /dev/null +++ b/Jellyfin.Server.Implementations/StorageHelpers/StorageHelper.cs @@ -0,0 +1,111 @@ +using System; +using System.Globalization; +using System.IO; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.System; +using Microsoft.Extensions.Logging; + +namespace Jellyfin.Server.Implementations.StorageHelpers; + +/// <summary> +/// Contains methods to help with checking for storage and returning storage data for jellyfin folders. +/// </summary> +public static class StorageHelper +{ + private const long TwoGigabyte = 2_147_483_647L; + private const long FiveHundredAndTwelveMegaByte = 536_870_911L; + private static readonly string[] _byteHumanizedSuffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB"]; + + /// <summary> + /// Tests the available storage capacity on the jellyfin paths with estimated minimum values. + /// </summary> + /// <param name="applicationPaths">The application paths.</param> + /// <param name="logger">Logger.</param> + public static void TestCommonPathsForStorageCapacity(IApplicationPaths applicationPaths, ILogger logger) + { + TestDataDirectorySize(applicationPaths.DataPath, logger, TwoGigabyte); + TestDataDirectorySize(applicationPaths.LogDirectoryPath, logger, FiveHundredAndTwelveMegaByte); + TestDataDirectorySize(applicationPaths.CachePath, logger, TwoGigabyte); + TestDataDirectorySize(applicationPaths.ProgramDataPath, logger, TwoGigabyte); + TestDataDirectorySize(applicationPaths.TempDirectory, logger, TwoGigabyte); + } + + /// <summary> + /// Gets the free space of a specific directory. + /// </summary> + /// <param name="path">Path to a folder.</param> + /// <returns>The number of bytes available space.</returns> + public static FolderStorageInfo GetFreeSpaceOf(string path) + { + try + { + var driveInfo = new DriveInfo(path); + return new FolderStorageInfo() + { + Path = path, + FreeSpace = driveInfo.AvailableFreeSpace, + UsedSpace = driveInfo.TotalSize - driveInfo.AvailableFreeSpace, + StorageType = driveInfo.DriveType.ToString(), + DeviceId = driveInfo.Name, + }; + } + catch + { + return new FolderStorageInfo() + { + Path = path, + FreeSpace = -1, + UsedSpace = -1, + StorageType = null, + DeviceId = null + }; + } + } + + /// <summary> + /// Gets the underlying drive data from a given path and checks if the available storage capacity matches the threshold. + /// </summary> + /// <param name="path">The path to a folder to evaluate.</param> + /// <param name="logger">The logger.</param> + /// <param name="threshold">The threshold to check for or -1 to just log the data.</param> + /// <exception cref="InvalidOperationException">Thrown when the threshold is not available on the underlying storage.</exception> + private static void TestDataDirectorySize(string path, ILogger logger, long threshold = -1) + { + logger.LogDebug("Check path {TestPath} for storage capacity", path); + Directory.CreateDirectory(path); + + var drive = new DriveInfo(path); + if (threshold != -1 && drive.AvailableFreeSpace < threshold) + { + throw new InvalidOperationException($"The path `{path}` has insufficient free space. Required: at least {HumanizeStorageSize(threshold)}."); + } + + logger.LogInformation( + "Storage path `{TestPath}` ({StorageType}) successfully checked with {FreeSpace} free which is over the minimum of {MinFree}.", + path, + drive.DriveType, + HumanizeStorageSize(drive.AvailableFreeSpace), + HumanizeStorageSize(threshold)); + } + + /// <summary> + /// Formats a size in bytes into a common human readable form. + /// </summary> + /// <remarks> + /// Taken and slightly modified from https://stackoverflow.com/a/4975942/1786007 . + /// </remarks> + /// <param name="byteCount">The size in bytes.</param> + /// <returns>A human readable approximate representation of the argument.</returns> + public static string HumanizeStorageSize(long byteCount) + { + if (byteCount == 0) + { + return $"0{_byteHumanizedSuffixes[0]}"; + } + + var bytes = Math.Abs(byteCount); + var place = Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024))); + var num = Math.Round(bytes / Math.Pow(1024, place), 1); + return (Math.Sign(byteCount) * num).ToString(CultureInfo.InvariantCulture) + _byteHumanizedSuffixes[place]; + } +} diff --git a/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs b/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs index 5d209b0af..6f2d2a107 100644 --- a/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs +++ b/Jellyfin.Server.Implementations/Trickplay/TrickplayManager.cs @@ -7,12 +7,14 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using AsyncKeyedLock; -using Jellyfin.Data.Entities; +using J2N.Collections.Generic.Extensions; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.IO; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Trickplay; using MediaBrowser.Model.Configuration; @@ -32,14 +34,14 @@ public class TrickplayManager : ITrickplayManager private readonly IMediaEncoder _mediaEncoder; private readonly IFileSystem _fileSystem; private readonly EncodingHelper _encodingHelper; - private readonly ILibraryManager _libraryManager; private readonly IServerConfigurationManager _config; private readonly IImageEncoder _imageEncoder; private readonly IDbContextFactory<JellyfinDbContext> _dbProvider; private readonly IApplicationPaths _appPaths; + private readonly IPathManager _pathManager; private static readonly AsyncNonKeyedLocker _resourcePool = new(1); - private static readonly string[] _trickplayImgExtensions = { ".jpg" }; + private static readonly string[] _trickplayImgExtensions = [".jpg"]; /// <summary> /// Initializes a new instance of the <see cref="TrickplayManager"/> class. @@ -48,38 +50,38 @@ public class TrickplayManager : ITrickplayManager /// <param name="mediaEncoder">The media encoder.</param> /// <param name="fileSystem">The file system.</param> /// <param name="encodingHelper">The encoding helper.</param> - /// <param name="libraryManager">The library manager.</param> /// <param name="config">The server configuration manager.</param> /// <param name="imageEncoder">The image encoder.</param> /// <param name="dbProvider">The database provider.</param> /// <param name="appPaths">The application paths.</param> + /// <param name="pathManager">The path manager.</param> public TrickplayManager( ILogger<TrickplayManager> logger, IMediaEncoder mediaEncoder, IFileSystem fileSystem, EncodingHelper encodingHelper, - ILibraryManager libraryManager, IServerConfigurationManager config, IImageEncoder imageEncoder, IDbContextFactory<JellyfinDbContext> dbProvider, - IApplicationPaths appPaths) + IApplicationPaths appPaths, + IPathManager pathManager) { _logger = logger; _mediaEncoder = mediaEncoder; _fileSystem = fileSystem; _encodingHelper = encodingHelper; - _libraryManager = libraryManager; _config = config; _imageEncoder = imageEncoder; _dbProvider = dbProvider; _appPaths = appPaths; + _pathManager = pathManager; } /// <inheritdoc /> - public async Task MoveGeneratedTrickplayDataAsync(Video video, LibraryOptions? libraryOptions, CancellationToken cancellationToken) + public async Task MoveGeneratedTrickplayDataAsync(Video video, LibraryOptions libraryOptions, CancellationToken cancellationToken) { var options = _config.Configuration.TrickplayOptions; - if (!CanGenerateTrickplay(video, options.Interval)) + if (libraryOptions is null || !libraryOptions.EnableTrickplayImageExtraction || !CanGenerateTrickplay(video, options.Interval)) { return; } @@ -91,28 +93,28 @@ public class TrickplayManager : ITrickplayManager var existingResolution = resolution.Key; var tileWidth = resolution.Value.TileWidth; var tileHeight = resolution.Value.TileHeight; - var shouldBeSavedWithMedia = libraryOptions is null ? false : libraryOptions.SaveTrickplayWithMedia; - var localOutputDir = GetTrickplayDirectory(video, tileWidth, tileHeight, existingResolution, false); - var mediaOutputDir = GetTrickplayDirectory(video, tileWidth, tileHeight, existingResolution, true); - if (shouldBeSavedWithMedia && Directory.Exists(localOutputDir)) + var shouldBeSavedWithMedia = libraryOptions is not null && libraryOptions.SaveTrickplayWithMedia; + var localOutputDir = new DirectoryInfo(GetTrickplayDirectory(video, tileWidth, tileHeight, existingResolution, false)); + var mediaOutputDir = new DirectoryInfo(GetTrickplayDirectory(video, tileWidth, tileHeight, existingResolution, true)); + if (shouldBeSavedWithMedia && localOutputDir.Exists) { - var localDirFiles = Directory.GetFiles(localOutputDir); - var mediaDirExists = Directory.Exists(mediaOutputDir); - if (localDirFiles.Length > 0 && ((mediaDirExists && Directory.GetFiles(mediaOutputDir).Length == 0) || !mediaDirExists)) + var localDirFiles = localOutputDir.EnumerateFiles(); + var mediaDirExists = mediaOutputDir.Exists; + if (localDirFiles.Any() && ((mediaDirExists && mediaOutputDir.EnumerateFiles().Any()) || !mediaDirExists)) { // Move images from local dir to media dir - MoveContent(localOutputDir, mediaOutputDir); + MoveContent(localOutputDir.FullName, mediaOutputDir.FullName); _logger.LogInformation("Moved trickplay images for {ItemName} to {Location}", video.Name, mediaOutputDir); } } - else if (!shouldBeSavedWithMedia && Directory.Exists(mediaOutputDir)) + else if (!shouldBeSavedWithMedia && mediaOutputDir.Exists) { - var mediaDirFiles = Directory.GetFiles(mediaOutputDir); - var localDirExists = Directory.Exists(localOutputDir); - if (mediaDirFiles.Length > 0 && ((localDirExists && Directory.GetFiles(localOutputDir).Length == 0) || !localDirExists)) + var mediaDirFiles = mediaOutputDir.EnumerateFiles(); + var localDirExists = localOutputDir.Exists; + if (mediaDirFiles.Any() && ((localDirExists && localOutputDir.EnumerateFiles().Any()) || !localDirExists)) { // Move images from media dir to local dir - MoveContent(mediaOutputDir, localOutputDir); + MoveContent(mediaOutputDir.FullName, localOutputDir.FullName); _logger.LogInformation("Moved trickplay images for {ItemName} to {Location}", video.Name, localOutputDir); } } @@ -125,36 +127,98 @@ public class TrickplayManager : ITrickplayManager var parent = Directory.GetParent(sourceFolder); if (parent is not null) { - var parentContent = Directory.GetDirectories(parent.FullName); - if (parentContent.Length == 0) + var parentContent = parent.EnumerateDirectories(); + if (!parentContent.Any()) { - Directory.Delete(parent.FullName); + parent.Delete(); } } } /// <inheritdoc /> - public async Task RefreshTrickplayDataAsync(Video video, bool replace, LibraryOptions? libraryOptions, CancellationToken cancellationToken) + public async Task RefreshTrickplayDataAsync(Video video, bool replace, LibraryOptions libraryOptions, CancellationToken cancellationToken) { - _logger.LogDebug("Trickplay refresh for {ItemId} (replace existing: {Replace})", video.Id, replace); - var options = _config.Configuration.TrickplayOptions; - if (options.Interval < 1000) + if (!CanGenerateTrickplay(video, options.Interval) || libraryOptions is null) { - _logger.LogWarning("Trickplay image interval {Interval} is too small, reset to the minimum valid value of 1000", options.Interval); - options.Interval = 1000; + return; } - foreach (var width in options.WidthResolutions) + var dbContext = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false); + await using (dbContext.ConfigureAwait(false)) { - cancellationToken.ThrowIfCancellationRequested(); - await RefreshTrickplayDataInternal( - video, - replace, - width, - options, - libraryOptions, - cancellationToken).ConfigureAwait(false); + var saveWithMedia = libraryOptions.SaveTrickplayWithMedia; + var trickplayDirectory = _pathManager.GetTrickplayDirectory(video, saveWithMedia); + if (!libraryOptions.EnableTrickplayImageExtraction || replace) + { + // Prune existing data + if (Directory.Exists(trickplayDirectory)) + { + try + { + Directory.Delete(trickplayDirectory, true); + } + catch (Exception ex) + { + _logger.LogWarning("Unable to clear trickplay directory: {Directory}: {Exception}", trickplayDirectory, ex); + } + } + + await dbContext.TrickplayInfos + .Where(i => i.ItemId.Equals(video.Id)) + .ExecuteDeleteAsync(cancellationToken) + .ConfigureAwait(false); + + if (!replace) + { + return; + } + } + + _logger.LogDebug("Trickplay refresh for {ItemId} (replace existing: {Replace})", video.Id, replace); + + if (options.Interval < 1000) + { + _logger.LogWarning("Trickplay image interval {Interval} is too small, reset to the minimum valid value of 1000", options.Interval); + options.Interval = 1000; + } + + foreach (var width in options.WidthResolutions) + { + cancellationToken.ThrowIfCancellationRequested(); + await RefreshTrickplayDataInternal( + video, + replace, + width, + options, + saveWithMedia, + cancellationToken).ConfigureAwait(false); + } + + // Cleanup old trickplay files + if (Directory.Exists(trickplayDirectory)) + { + var existingFolders = Directory.GetDirectories(trickplayDirectory).ToList(); + var trickplayInfos = await dbContext.TrickplayInfos + .AsNoTracking() + .Where(i => i.ItemId.Equals(video.Id)) + .ToListAsync(cancellationToken) + .ConfigureAwait(false); + var expectedFolders = trickplayInfos.Select(i => GetTrickplayDirectory(video, i.TileWidth, i.TileHeight, i.Width, saveWithMedia)).ToList(); + var foldersToRemove = existingFolders.Except(expectedFolders); + foreach (var folder in foldersToRemove) + { + try + { + _logger.LogWarning("Pruning trickplay files for {Item}", video.Path); + Directory.Delete(folder, true); + } + catch (Exception ex) + { + _logger.LogWarning("Unable to remove trickplay directory: {Directory}: {Exception}", folder, ex); + } + } + } } } @@ -163,14 +227,9 @@ public class TrickplayManager : ITrickplayManager bool replace, int width, TrickplayOptions options, - LibraryOptions? libraryOptions, + bool saveWithMedia, CancellationToken cancellationToken) { - if (!CanGenerateTrickplay(video, options.Interval)) - { - return; - } - var imgTempDir = string.Empty; using (await _resourcePool.LockAsync(cancellationToken).ConfigureAwait(false)) @@ -214,13 +273,12 @@ public class TrickplayManager : ITrickplayManager var tileWidth = options.TileWidth; var tileHeight = options.TileHeight; - var saveWithMedia = libraryOptions is null ? false : libraryOptions.SaveTrickplayWithMedia; - var outputDir = GetTrickplayDirectory(video, tileWidth, tileHeight, actualWidth, saveWithMedia); + var outputDir = new DirectoryInfo(GetTrickplayDirectory(video, tileWidth, tileHeight, actualWidth, saveWithMedia)); // Import existing trickplay tiles - if (!replace && Directory.Exists(outputDir)) + if (!replace && outputDir.Exists) { - var existingFiles = Directory.GetFiles(outputDir); + var existingFiles = outputDir.GetFiles(); if (existingFiles.Length > 0) { var hasTrickplayResolution = await HasTrickplayResolutionAsync(video.Id, actualWidth).ConfigureAwait(false); @@ -245,9 +303,9 @@ public class TrickplayManager : ITrickplayManager foreach (var tile in existingFiles) { - var image = _imageEncoder.GetImageSize(tile); + var image = _imageEncoder.GetImageSize(tile.FullName); localTrickplayInfo.Height = Math.Max(localTrickplayInfo.Height, (int)Math.Ceiling((double)image.Height / localTrickplayInfo.TileHeight)); - var bitrate = (int)Math.Ceiling((decimal)new FileInfo(tile).Length * 8 / localTrickplayInfo.TileWidth / localTrickplayInfo.TileHeight / (localTrickplayInfo.Interval / 1000)); + var bitrate = (int)Math.Ceiling((decimal)tile.Length * 8 / localTrickplayInfo.TileWidth / localTrickplayInfo.TileHeight / (localTrickplayInfo.Interval / 1000)); localTrickplayInfo.Bandwidth = Math.Max(localTrickplayInfo.Bandwidth, bitrate); } @@ -290,7 +348,7 @@ public class TrickplayManager : ITrickplayManager .ToList(); // Create tiles - var trickplayInfo = CreateTiles(images, actualWidth, options, outputDir); + var trickplayInfo = CreateTiles(images, actualWidth, options, outputDir.FullName); // Save tiles info try @@ -313,7 +371,7 @@ public class TrickplayManager : ITrickplayManager // Make sure no files stay in metadata folders on failure // if tiles info wasn't saved. - Directory.Delete(outputDir, true); + outputDir.Delete(true); } } catch (Exception ex) @@ -429,12 +487,6 @@ public class TrickplayManager : ITrickplayManager return false; } - var libraryOptions = _libraryManager.GetLibraryOptions(video); - if (libraryOptions is null || !libraryOptions.EnableTrickplayImageExtraction) - { - return false; - } - // Can't extract images if there are no video streams return video.GetMediaStreams().Count > 0; } @@ -501,6 +553,13 @@ public class TrickplayManager : ITrickplayManager } /// <inheritdoc /> + public async Task DeleteTrickplayDataAsync(Guid itemId, CancellationToken cancellationToken) + { + var dbContext = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false); + await dbContext.TrickplayInfos.Where(i => i.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + } + + /// <inheritdoc /> public async Task<Dictionary<string, Dictionary<int, TrickplayInfo>>> GetTrickplayManifest(BaseItem item) { var trickplayManifest = new Dictionary<string, Dictionary<int, TrickplayInfo>>(); @@ -610,10 +669,7 @@ public class TrickplayManager : ITrickplayManager /// <inheritdoc /> public string GetTrickplayDirectory(BaseItem item, int tileWidth, int tileHeight, int width, bool saveWithMedia = false) { - var path = saveWithMedia - ? Path.Combine(item.ContainingFolderPath, Path.ChangeExtension(item.Path, ".trickplay")) - : Path.Combine(item.GetInternalMetadataPath(), "trickplay"); - + var path = _pathManager.GetTrickplayDirectory(item, saveWithMedia); var subdirectory = string.Format( CultureInfo.InvariantCulture, "{0} - {1}x{2}", diff --git a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs index acada7aa4..35c43b176 100644 --- a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs +++ b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs @@ -2,7 +2,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Authentication; using MediaBrowser.Model.Cryptography; using Microsoft.Extensions.Logging; diff --git a/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs index cefbd0624..6296881a9 100644 --- a/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs +++ b/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs @@ -4,7 +4,7 @@ using System.IO; using System.Security.Cryptography; using System.Text.Json; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Common; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Authentication; diff --git a/Jellyfin.Server.Implementations/Users/DeviceAccessHost.cs b/Jellyfin.Server.Implementations/Users/DeviceAccessHost.cs index 45b0a0853..92e2bb4fa 100644 --- a/Jellyfin.Server.Implementations/Users/DeviceAccessHost.cs +++ b/Jellyfin.Server.Implementations/Users/DeviceAccessHost.cs @@ -1,9 +1,10 @@ using System.Threading; using System.Threading.Tasks; -using Jellyfin.Data.Entities; -using Jellyfin.Data.Enums; +using Jellyfin.Data; using Jellyfin.Data.Events; using Jellyfin.Data.Queries; +using Jellyfin.Database.Implementations.Entities; +using Jellyfin.Database.Implementations.Enums; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Session; diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs index e204a16a6..0f21e11a3 100644 --- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs +++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs @@ -5,7 +5,8 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller; using Microsoft.EntityFrameworkCore; diff --git a/Jellyfin.Server.Implementations/Users/InvalidAuthProvider.cs b/Jellyfin.Server.Implementations/Users/InvalidAuthProvider.cs index c4e4c460a..caf9d5bd9 100644 --- a/Jellyfin.Server.Implementations/Users/InvalidAuthProvider.cs +++ b/Jellyfin.Server.Implementations/Users/InvalidAuthProvider.cs @@ -1,5 +1,5 @@ using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Database.Implementations.Entities; using MediaBrowser.Controller.Authentication; namespace Jellyfin.Server.Implementations.Users diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 5a11fadc5..4f944c87d 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -7,10 +7,13 @@ using System.Globalization; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; -using Jellyfin.Data.Entities; +using Jellyfin.Data; using Jellyfin.Data.Enums; using Jellyfin.Data.Events; using Jellyfin.Data.Events.Users; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.Entities; +using Jellyfin.Database.Implementations.Enums; using Jellyfin.Extensions; using MediaBrowser.Common; using MediaBrowser.Common.Extensions; @@ -146,7 +149,7 @@ namespace Jellyfin.Server.Implementations.Users ThrowIfInvalidUsername(newName); - if (user.Username.Equals(newName, StringComparison.Ordinal)) + if (user.Username.Equals(newName, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("The new and old names must be different."); } @@ -154,8 +157,11 @@ namespace Jellyfin.Server.Implementations.Users var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); await using (dbContext.ConfigureAwait(false)) { +#pragma warning disable CA1862 // Use the 'StringComparison' method overloads to perform case-insensitive string comparisons +#pragma warning disable CA1311 // Specify a culture or use an invariant version to avoid implicit dependency on current culture +#pragma warning disable CA1304 // The behavior of 'string.ToUpper()' could vary based on the current user's locale settings if (await dbContext.Users - .AnyAsync(u => u.Username == newName && !u.Id.Equals(user.Id)) + .AnyAsync(u => u.Username.ToUpper() == newName.ToUpper() && !u.Id.Equals(user.Id)) .ConfigureAwait(false)) { throw new ArgumentException(string.Format( @@ -163,6 +169,9 @@ namespace Jellyfin.Server.Implementations.Users "A user with the name '{0}' already exists.", newName)); } +#pragma warning restore CA1304 // The behavior of 'string.ToUpper()' could vary based on the current user's locale settings +#pragma warning restore CA1311 // Specify a culture or use an invariant version to avoid implicit dependency on current culture +#pragma warning restore CA1862 // Use the 'StringComparison' method overloads to perform case-insensitive string comparisons user.Username = newName; await UpdateUserInternalAsync(dbContext, user).ConfigureAwait(false); @@ -333,7 +342,8 @@ namespace Jellyfin.Server.Implementations.Users }, Policy = new UserPolicy { - MaxParentalRating = user.MaxParentalAgeRating, + MaxParentalRating = user.MaxParentalRatingScore, + MaxParentalSubRating = user.MaxParentalRatingSubScore, EnableUserPreferenceAccess = user.EnableUserPreferenceAccess, RemoteClientBitrateLimit = user.RemoteClientBitrateLimit ?? 0, AuthenticationProviderId = user.AuthenticationProviderId, @@ -659,7 +669,8 @@ namespace Jellyfin.Server.Implementations.Users _ => policy.LoginAttemptsBeforeLockout }; - user.MaxParentalAgeRating = policy.MaxParentalRating; + user.MaxParentalRatingScore = policy.MaxParentalRating; + user.MaxParentalRatingSubScore = policy.MaxParentalSubRating; user.EnableUserPreferenceAccess = policy.EnableUserPreferenceAccess; user.RemoteClientBitrateLimit = policy.RemoteClientBitrateLimit; user.AuthenticationProviderId = policy.AuthenticationProviderId; diff --git a/Jellyfin.Server.Implementations/ValueConverters/DateTimeKindValueConverter.cs b/Jellyfin.Server.Implementations/ValueConverters/DateTimeKindValueConverter.cs deleted file mode 100644 index 2e585c92d..000000000 --- a/Jellyfin.Server.Implementations/ValueConverters/DateTimeKindValueConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Jellyfin.Server.Implementations.ValueConverters -{ - /// <summary> - /// ValueConverter to specify kind. - /// </summary> - public class DateTimeKindValueConverter : ValueConverter<DateTime, DateTime> - { - /// <summary> - /// Initializes a new instance of the <see cref="DateTimeKindValueConverter"/> class. - /// </summary> - /// <param name="kind">The kind to specify.</param> - /// <param name="mappingHints">The mapping hints.</param> - public DateTimeKindValueConverter(DateTimeKind kind, ConverterMappingHints? mappingHints = null) - : base(v => v.ToUniversalTime(), v => DateTime.SpecifyKind(v, kind), mappingHints) - { - } - } -} |
