We are now using the new request service and storing the requests as json blobs

Added the db migration code. This can be removed in the next few builds.
This commit is contained in:
tidusjar 2016-03-18 13:52:10 +00:00
commit 2e8bb783d9
3 changed files with 17 additions and 4 deletions

View file

@ -68,7 +68,7 @@ namespace PlexRequests.Core
s.SaveSettings(defaultSettings);
}
private void MigrateDb()
private void MigrateDb() // TODO: Remove when no longer needed
{
var repo = new GenericRepository<RequestedModel>(Db);
var records = repo.GetAll();
@ -88,7 +88,20 @@ namespace PlexRequests.Core
{
throw new SqliteException("Could not migrate the DB!");
}
if (result.Count != requestedModels.Length)
{
throw new SqliteException("Could not migrate the DB! count is different");
}
// Now delete the old requests
foreach (var oldRequest in requestedModels)
{
repo.Delete(oldRequest);
}
}
}
}