DesignTimeJellyfinDbFactory.cs 733 B

1234567891011121314151617181920
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.EntityFrameworkCore.Design;
  3. namespace Jellyfin.Server.Implementations.Migrations
  4. {
  5. /// <summary>
  6. /// The design time factory for <see cref="JellyfinDbContext"/>.
  7. /// This is only used for the creation of migrations and not during runtime.
  8. /// </summary>
  9. internal class DesignTimeJellyfinDbFactory : IDesignTimeDbContextFactory<JellyfinDbContext>
  10. {
  11. public JellyfinDbContext CreateDbContext(string[] args)
  12. {
  13. var optionsBuilder = new DbContextOptionsBuilder<JellyfinDbContext>();
  14. optionsBuilder.UseSqlite("Data Source=jellyfin.db");
  15. return new JellyfinDbContext(optionsBuilder.Options);
  16. }
  17. }
  18. }