mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
Migration setup
This commit is contained in:
parent
b06c55c2bf
commit
bfea681522
3 changed files with 36 additions and 5 deletions
|
@ -58,7 +58,8 @@ namespace PlexRequests.Core.SettingModels
|
||||||
public bool Wizard { get; set; }
|
public bool Wizard { get; set; }
|
||||||
public bool DisableTvRequestsByEpisode { get; set; }
|
public bool DisableTvRequestsByEpisode { get; set; }
|
||||||
public bool DisableTvRequestsBySeason { get; set; }
|
public bool DisableTvRequestsBySeason { get; set; }
|
||||||
|
//To Remove at some point?
|
||||||
|
public bool SendRecentlyAddedEmail { get; set; }
|
||||||
public string CustomDonationUrl { get; set; }
|
public string CustomDonationUrl { get; set; }
|
||||||
public bool EnableCustomDonationUrl { get; set; }
|
public bool EnableCustomDonationUrl { get; set; }
|
||||||
public string CustomDonationMessage { get; set; }
|
public string CustomDonationMessage { get; set; }
|
||||||
|
|
|
@ -72,6 +72,10 @@ namespace PlexRequests.Core
|
||||||
{
|
{
|
||||||
MigrateToVersion1910();
|
MigrateToVersion1910();
|
||||||
}
|
}
|
||||||
|
if (version > 1943 && version <= 1945)
|
||||||
|
{
|
||||||
|
MigrateToVersion1945();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Db.DbConnection().ConnectionString;
|
return Db.DbConnection().ConnectionString;
|
||||||
|
@ -275,5 +279,31 @@ namespace PlexRequests.Core
|
||||||
Log.Error(e);
|
Log.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Migrates to version1945
|
||||||
|
/// </summary>
|
||||||
|
public void MigrateToVersion1945()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var settings = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(Db, new MemoryCacheProvider()));
|
||||||
|
var plex = settings.GetSettings();
|
||||||
|
var newsLetterSettings = new SettingsServiceV2<NewletterSettings>(new SettingsJsonRepository(Db, new MemoryCacheProvider()));
|
||||||
|
var newsLetter = newsLetterSettings.GetSettings();
|
||||||
|
if (plex.SendRecentlyAddedEmail)
|
||||||
|
{
|
||||||
|
newsLetter.SendRecentlyAddedEmail = plex.SendRecentlyAddedEmail;
|
||||||
|
plex.SendRecentlyAddedEmail = false;
|
||||||
|
settings.SaveSettings(plex);
|
||||||
|
newsLetterSettings.SaveSettings(newsLetter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,14 @@ namespace PlexRequests.Services.Jobs
|
||||||
public class RecentlyAdded : IJob, IRecentlyAdded
|
public class RecentlyAdded : IJob, IRecentlyAdded
|
||||||
{
|
{
|
||||||
public RecentlyAdded(IPlexApi api, ISettingsService<PlexSettings> plexSettings, ISettingsService<EmailNotificationSettings> email,
|
public RecentlyAdded(IPlexApi api, ISettingsService<PlexSettings> plexSettings, ISettingsService<EmailNotificationSettings> email,
|
||||||
ISettingsService<ScheduledJobsSettings> scheduledService, IJobRecord rec, ISettingsService<NewletterSettings> plexRequest)
|
ISettingsService<ScheduledJobsSettings> scheduledService, IJobRecord rec, ISettingsService<NewletterSettings> newsletter)
|
||||||
{
|
{
|
||||||
JobRecord = rec;
|
JobRecord = rec;
|
||||||
Api = api;
|
Api = api;
|
||||||
PlexSettings = plexSettings;
|
PlexSettings = plexSettings;
|
||||||
EmailSettings = email;
|
EmailSettings = email;
|
||||||
ScheduledJobsSettings = scheduledService;
|
ScheduledJobsSettings = scheduledService;
|
||||||
PlexRequestSettings = plexRequest;
|
NewsletterSettings = newsletter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPlexApi Api { get; }
|
private IPlexApi Api { get; }
|
||||||
|
@ -63,7 +63,7 @@ namespace PlexRequests.Services.Jobs
|
||||||
private readonly TheMovieDbApi _movieApi = new TheMovieDbApi();
|
private readonly TheMovieDbApi _movieApi = new TheMovieDbApi();
|
||||||
private ISettingsService<PlexSettings> PlexSettings { get; }
|
private ISettingsService<PlexSettings> PlexSettings { get; }
|
||||||
private ISettingsService<EmailNotificationSettings> EmailSettings { get; }
|
private ISettingsService<EmailNotificationSettings> EmailSettings { get; }
|
||||||
private ISettingsService<NewletterSettings> PlexRequestSettings { get; }
|
private ISettingsService<NewletterSettings> NewsletterSettings { get; }
|
||||||
private ISettingsService<ScheduledJobsSettings> ScheduledJobsSettings { get; }
|
private ISettingsService<ScheduledJobsSettings> ScheduledJobsSettings { get; }
|
||||||
private IJobRecord JobRecord { get; }
|
private IJobRecord JobRecord { get; }
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ namespace PlexRequests.Services.Jobs
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var settings = PlexRequestSettings.GetSettings();
|
var settings = NewsletterSettings.GetSettings();
|
||||||
if (!settings.SendRecentlyAddedEmail)
|
if (!settings.SendRecentlyAddedEmail)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue