mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Added our own custom migrations, a lot easier to migrate DB versions now.
This commit is contained in:
parent
171c64fe8e
commit
6e3339ad3c
16 changed files with 492 additions and 30 deletions
|
@ -60,6 +60,8 @@ namespace PlexRequests.Core
|
|||
TableCreation.Vacuum(Db.DbConnection());
|
||||
}
|
||||
|
||||
|
||||
// The below code is obsolete, we should use PlexRequests.Core.Migrations.MigrationRunner
|
||||
var version = CheckSchema();
|
||||
if (version > 0)
|
||||
{
|
||||
|
@ -72,10 +74,6 @@ namespace PlexRequests.Core
|
|||
{
|
||||
MigrateToVersion1910();
|
||||
}
|
||||
if (version > 1943 && version <= 1945)
|
||||
{
|
||||
MigrateToVersion1945();
|
||||
}
|
||||
}
|
||||
|
||||
return Db.DbConnection().ConnectionString;
|
||||
|
@ -279,31 +277,5 @@ namespace PlexRequests.Core
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue