|
|
@ -47,8 +47,7 @@ namespace Ombi
|
|
|
|
instance.StoragePath = storagePath ?? string.Empty;
|
|
|
|
instance.StoragePath = storagePath ?? string.Empty;
|
|
|
|
// Check if we need to migrate the settings
|
|
|
|
// Check if we need to migrate the settings
|
|
|
|
CheckAndMigrate();
|
|
|
|
CheckAndMigrate();
|
|
|
|
using (var ctx = new SettingsContext())
|
|
|
|
var ctx = new SettingsContext();
|
|
|
|
{
|
|
|
|
|
|
|
|
var config = ctx.ApplicationConfigurations.ToList();
|
|
|
|
var config = ctx.ApplicationConfigurations.ToList();
|
|
|
|
var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url);
|
|
|
|
var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url);
|
|
|
|
var dbBaseUrl = config.FirstOrDefault(x => x.Type == ConfigurationTypes.BaseUrl);
|
|
|
|
var dbBaseUrl = config.FirstOrDefault(x => x.Type == ConfigurationTypes.BaseUrl);
|
|
|
@ -89,7 +88,6 @@ namespace Ombi
|
|
|
|
dbBaseUrl.Value = baseUrl;
|
|
|
|
dbBaseUrl.Value = baseUrl;
|
|
|
|
ctx.SaveChanges();
|
|
|
|
ctx.SaveChanges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DeleteSchedulesDb();
|
|
|
|
DeleteSchedulesDb();
|
|
|
|
|
|
|
|
|
|
|
@ -111,9 +109,9 @@ namespace Ombi
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var doneGlobal = false;
|
|
|
|
var doneGlobal = false;
|
|
|
|
var doneConfig = false;
|
|
|
|
var doneConfig = false;
|
|
|
|
using (var ombi = new OmbiContext())
|
|
|
|
var ombi = new OmbiContext();
|
|
|
|
using (var settings = new SettingsContext())
|
|
|
|
var settings = new SettingsContext();
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ombi.Settings.Any())
|
|
|
|
if (ombi.Settings.Any())
|
|
|
@ -148,15 +146,11 @@ namespace Ombi
|
|
|
|
if (doneConfig)
|
|
|
|
if (doneConfig)
|
|
|
|
ombi.Database.ExecuteSqlCommand("DELETE FROM ApplicationConfiguration");
|
|
|
|
ombi.Database.ExecuteSqlCommand("DELETE FROM ApplicationConfiguration");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now migrate all the external stuff
|
|
|
|
// Now migrate all the external stuff
|
|
|
|
using (var ombi = new OmbiContext())
|
|
|
|
var external = new ExternalContext();
|
|
|
|
using (var external = new ExternalContext())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (ombi.PlexEpisode.Any())
|
|
|
|
if (ombi.PlexEpisode.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
external.PlexEpisode.AddRange(ombi.PlexEpisode.ToList());
|
|
|
|
external.PlexEpisode.AddRange(ombi.PlexEpisode.ToList());
|
|
|
@ -229,8 +223,6 @@ namespace Ombi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DeleteSchedulesDb()
|
|
|
|
private static void DeleteSchedulesDb()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|