jellyfin/Jellyfin.Server.Implementations/Migrations/DesignTimeJellyfinDbFactory.cs

21 lines
733 B
C#
Raw Normal View History

2020-05-02 22:32:22 +00:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace Jellyfin.Server.Implementations.Migrations
{
/// <summary>
2023-01-16 17:14:44 +00:00
/// The design time factory for <see cref="JellyfinDbContext"/>.
2020-05-02 22:32:22 +00:00
/// This is only used for the creation of migrations and not during runtime.
/// </summary>
2023-01-16 17:14:44 +00:00
internal class DesignTimeJellyfinDbFactory : IDesignTimeDbContextFactory<JellyfinDbContext>
2020-05-02 22:32:22 +00:00
{
2023-01-16 17:14:44 +00:00
public JellyfinDbContext CreateDbContext(string[] args)
2020-05-02 22:32:22 +00:00
{
2023-01-16 17:14:44 +00:00
var optionsBuilder = new DbContextOptionsBuilder<JellyfinDbContext>();
2020-05-15 16:51:18 +00:00
optionsBuilder.UseSqlite("Data Source=jellyfin.db");
2020-05-02 22:32:22 +00:00
2023-01-16 17:14:44 +00:00
return new JellyfinDbContext(optionsBuilder.Options);
2020-05-02 22:32:22 +00:00
}
}
}