Database migrations (#13)

* remove last use of dbcontextfactory

* add initial migration
This commit is contained in:
Jason Dove
2021-02-12 12:50:04 +00:00
committed by GitHub
parent c2d8a54a47
commit db054ece24
31 changed files with 2869 additions and 104 deletions
+5 -15
View File
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Channels;
using ErsatzTV.Application;
@@ -100,23 +99,14 @@ namespace ErsatzTV
// string xmltvPath = Path.Combine(appDataFolder, "xmltv.xml");
// Log.Logger.Information("XMLTV is at {XmltvPath}", xmltvPath);
services.AddDbContextFactory<TvContext>(
options =>
{
options.UseSqlite(
$"Data Source={FileSystemLayout.DatabasePath}",
o => o.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery));
if (Debugger.IsAttached)
{
options.EnableSensitiveDataLogging();
}
});
services.AddDbContext<TvContext>(
options => options.UseSqlite(
$"Data Source={FileSystemLayout.DatabasePath}",
o => o.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery)));
o =>
{
o.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
o.MigrationsAssembly("ErsatzTV.Infrastructure");
}));
services.AddMediatR(typeof(GetAllChannels).Assembly);