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.
pull/35/head
tidusjar 9 years ago
parent b62b7c1305
commit 2e8bb783d9

@ -68,7 +68,7 @@ namespace PlexRequests.Core
s.SaveSettings(defaultSettings); s.SaveSettings(defaultSettings);
} }
private void MigrateDb() private void MigrateDb() // TODO: Remove when no longer needed
{ {
var repo = new GenericRepository<RequestedModel>(Db); var repo = new GenericRepository<RequestedModel>(Db);
var records = repo.GetAll(); var records = repo.GetAll();
@ -88,7 +88,20 @@ namespace PlexRequests.Core
{ {
throw new SqliteException("Could not migrate the DB!"); 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);
}
} }
} }
} }

@ -108,7 +108,7 @@ $(".theNoteSaveButton").click(function (e) {
if (checkJsonResponse(response)) { if (checkJsonResponse(response)) {
generateNotify("Success! Added Note.", "success"); generateNotify("Success! Added Note.", "success");
$("#myModal").modal("hide"); $("#myModal").modal("hide");
$('#adminNotesArea').html("<div>Note from Admin: " + comment + "</div>"); $('#adminNotesArea' + e.target.value).html("<div>Note from Admin: " + comment + "</div>");
} }
}, },
error: function (e) { error: function (e) {

@ -102,7 +102,7 @@
<div>Issue: {{issues}}</div> <div>Issue: {{issues}}</div>
{{/if}} {{/if}}
</div> </div>
<div id="adminNotesArea"> <div id="adminNotesArea{{requestId}}">
{{#if adminNote}} {{#if adminNote}}
<div>Note from Admin: {{adminNote}}</div> <div>Note from Admin: {{adminNote}}</div>
{{/if}} {{/if}}

Loading…
Cancel
Save