Applied review suggestions

This commit is contained in:
JPVenson 2025-02-03 20:15:36 +00:00
parent efb402b1d2
commit c9237ae731
5 changed files with 9 additions and 9 deletions

View File

@ -9,7 +9,7 @@ using Npgsql;
namespace Jellyfin.Database.Providers.PgSql; namespace Jellyfin.Database.Providers.PgSql;
/// <summary> /// <summary>
/// Configures jellyfin to use an SqLite database. /// Configures jellyfin to use an Postgres database.
/// </summary> /// </summary>
[JellyfinDatabaseProviderKey("Jellyfin-PgSql")] [JellyfinDatabaseProviderKey("Jellyfin-PgSql")]
public sealed class PgSqlDatabaseProvider : IJellyfinDatabaseProvider public sealed class PgSqlDatabaseProvider : IJellyfinDatabaseProvider

View File

@ -8,9 +8,9 @@ using Microsoft.Extensions.Logging;
namespace Jellyfin.Database.Providers.SqLite; namespace Jellyfin.Database.Providers.SqLite;
/// <summary> /// <summary>
/// Configures jellyfin to use an SqLite database. /// Configures jellyfin to use an SQLite database.
/// </summary> /// </summary>
[JellyfinDatabaseProviderKey("Jellyfin-SqLite")] [JellyfinDatabaseProviderKey("Jellyfin-SQLite")]
public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
{ {
private readonly IApplicationPaths _applicationPaths; private readonly IApplicationPaths _applicationPaths;

View File

@ -12,12 +12,12 @@ When creating a new migration, you always have to create migrations for all prov
dotnet ef migrations add MIGRATION_NAME --project "PATH_TO_PROJECT" -- --provider PROVIDER_KEY dotnet ef migrations add MIGRATION_NAME --project "PATH_TO_PROJECT" -- --provider PROVIDER_KEY
``` ```
with both sqlite and pgsql currently beeing supported and both need migrations, you need to run the efcore tool with the correct project to tell EfCore where to store the migrations and the correct provider key to tell jellyfin to load that provider. with both sqlite and pgsql currently beeing supported and both need migrations, you need to run the Entity Framework tool with the correct project to tell EFCore where to store the migrations and the correct provider key to tell jellyfin to load that provider.
The example is made from the root folder of the project e.g for codespaces `/workspaces/jellyfin` The example is made from the root folder of the project e.g for codespaces `/workspaces/jellyfin`
```cmd ```cmd
dotnet ef migrations add {MIGRATION_NAME} --project "Jellyfin.Database/Jellyfin.Database.Providers.SqLite" -- --migration-provider Jellyfin-SqLite dotnet ef migrations add {MIGRATION_NAME} --project "Jellyfin.Database/Jellyfin.Database.Providers.SqLite" -- --migration-provider Jellyfin-SQLite
dotnet ef migrations add {MIGRATION_NAME} --project "Jellyfin.Database/Jellyfin.Database.Providers.PgSql" -- --migration-provider Jellyfin-PgSql dotnet ef migrations add {MIGRATION_NAME} --project "Jellyfin.Database/Jellyfin.Database.Providers.PgSql" -- --migration-provider Jellyfin-PgSql
``` ```

View File

@ -72,10 +72,10 @@ public static class ServiceCollectionExtensions
} }
else else
{ {
// when nothing is setup via new Database configuration, fallback to SqLite with default settings. // when nothing is setup via new Database configuration, fallback to SQLite with default settings.
efCoreConfiguration = new DatabaseConfigurationOptions() efCoreConfiguration = new DatabaseConfigurationOptions()
{ {
DatabaseType = "Jellyfin-SqLite", DatabaseType = "Jellyfin-SQLite",
}; };
configurationManager.SaveConfiguration("database", efCoreConfiguration); configurationManager.SaveConfiguration("database", efCoreConfiguration);
} }

View File

@ -14,7 +14,7 @@ public class EfMigrationTests
{ {
var dbDesignContext = new PgSqlDesignTimeJellyfinDbFactory(); var dbDesignContext = new PgSqlDesignTimeJellyfinDbFactory();
var context = dbDesignContext.CreateDbContext([]); var context = dbDesignContext.CreateDbContext([]);
Assert.False(context.Database.HasPendingModelChanges(), "There are unapplied changes to the EfCore model for PgSQL. Please create a Migration."); Assert.False(context.Database.HasPendingModelChanges(), "There are unapplied changes to the EFCore model for PgSQL. Please create a Migration.");
} }
[Fact] [Fact]
@ -22,6 +22,6 @@ public class EfMigrationTests
{ {
var dbDesignContext = new SqliteDesignTimeJellyfinDbFactory(); var dbDesignContext = new SqliteDesignTimeJellyfinDbFactory();
var context = dbDesignContext.CreateDbContext([]); var context = dbDesignContext.CreateDbContext([]);
Assert.False(context.Database.HasPendingModelChanges(), "There are unapplied changes to the EfCore model for PgSQL. Please create a Migration."); Assert.False(context.Database.HasPendingModelChanges(), "There are unapplied changes to the EFCore model for SQLite. Please create a Migration.");
} }
} }