pull/772/head
Jamie.Rees 8 years ago
parent 5a513585de
commit 6cb6451abe

@ -4,6 +4,7 @@ using System.Data.Common;
using System.Linq;
using System.Reflection;
using Ninject;
using NLog;
using PlexRequests.Store;
namespace PlexRequests.Core.Migration
@ -18,6 +19,7 @@ namespace PlexRequests.Core.Migration
private IKernel Kernel { get; }
private ISqliteConfiguration Db { get; }
private static Logger _log = LogManager.GetCurrentClassLogger();
public void MigrateToLatest()
{
@ -32,6 +34,8 @@ namespace PlexRequests.Core.Migration
if (v.Value.Version > dbVersion.Version)
{
#endif
try
{
// Assuming only one constructor
var ctor = v.Key.GetConstructors().FirstOrDefault();
var dependencies = ctor.GetParameters().Select(param => Kernel.Get(param.ParameterType)).ToList();
@ -44,6 +48,13 @@ namespace PlexRequests.Core.Migration
method.Invoke(classInstance, parametersArray);
}
}
catch (Exception e)
{
_log.Fatal("Error when migrating");
_log.Fatal(e);
}
#if !DEBUG
}
#endif

@ -246,6 +246,10 @@ namespace PlexRequests.Core.Migration.Migrations
var requestedModels = allRequests.ToList();
foreach (var req in requestedModels)
{
if (string.IsNullOrEmpty(req.PosterPath))
{
continue;
}
if (req.PosterPath.Contains("https://image.tmdb.org/t/p/w150/"))
{
var newImg = req.PosterPath.Replace("https://image.tmdb.org/t/p/w150/", string.Empty);

Loading…
Cancel
Save