📄 src/Infrastructure/Database/JellyfinDbContextDesignFactory.cs
using Jellyfin.Database.Implementations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Logging.Abstractions;

namespace Slopper.Infrastructure.Database;

internal sealed class JellyfinDbContextDesignFactory : IDesignTimeDbContextFactory<JellyfinDbContext>
{
    public JellyfinDbContext CreateDbContext(string[] args) =>
        new(
            new DbContextOptionsBuilder<JellyfinDbContext>()
                .UseSqlite(args[0], b => b.MigrationsAssembly("Slopper.Infrastructure.Database"))
                .Options,
            NullLogger<JellyfinDbContext>.Instance,
            new JellyfinDatabaseProvider(),
            new EntityFrameworkCoreLockingBehavior()
        );
}