using Jellyfin.Server.Implementations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Logging.Abstractions;
namespace Jellyfin.Database.Providers.PgSql
{
///
/// The design time factory for .
/// This is only used for the creation of migrations and not during runtime.
///
internal sealed class PgSqlDesignTimeJellyfinDbFactory : IDesignTimeDbContextFactory
{
public JellyfinDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseNpgsql(f => f.MigrationsAssembly(GetType().Assembly));
return new JellyfinDbContext(
optionsBuilder.Options,
NullLogger.Instance,
new PgSqlDatabaseProvider(null!, NullLogger.Instance));
}
}
}