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