From 420e43dfaf83ef27e4ea21a2df34b05d36f0a84b Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 1 Apr 2016 22:17:15 +0100 Subject: [PATCH] Change the new columns type --- PlexRequests.Core/JsonRequestService.cs | 2 +- PlexRequests.Core/Setup.cs | 2 +- PlexRequests.Store/Models/RequestBlobs.cs | 1 + PlexRequests.Store/RequestedModel.cs | 2 -- PlexRequests.Store/SqlTables.sql | 3 ++- PlexRequests.UI/Modules/SearchModule.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PlexRequests.Core/JsonRequestService.cs b/PlexRequests.Core/JsonRequestService.cs index 45eccb51e..21ddcecc7 100644 --- a/PlexRequests.Core/JsonRequestService.cs +++ b/PlexRequests.Core/JsonRequestService.cs @@ -52,7 +52,7 @@ namespace PlexRequests.Core // TODO Keep an eye on this, since we are now doing 2 DB update for 1 single request, inserting and then updating model.Id = (int)id; - entity = new RequestBlobs { Type = model.Type, Content = ByteConverterHelper.ReturnBytes(model), ProviderId = model.ProviderId, Id = (int)id }; + entity = new RequestBlobs { Type = model.Type, Content = ByteConverterHelper.ReturnBytes(model), ProviderId = model.ProviderId, Id = (int)id, MusicId = model.MusicBrainzId}; var result = Repo.Update(entity); return result ? id : -1; diff --git a/PlexRequests.Core/Setup.cs b/PlexRequests.Core/Setup.cs index 0dc10a44d..69d3f9000 100644 --- a/PlexRequests.Core/Setup.cs +++ b/PlexRequests.Core/Setup.cs @@ -80,7 +80,7 @@ namespace PlexRequests.Core connection.UpdateSchemaVersion(SchemaVersion); try { - TableCreation.AlterTable(Db.DbConnection(), "RequestBlobs", "ADD COLUMN", "MusicId", false, "INTEGER"); + TableCreation.AlterTable(Db.DbConnection(), "RequestBlobs", "ADD COLUMN", "MusicId", false, "TEXT"); } catch (Exception e) { diff --git a/PlexRequests.Store/Models/RequestBlobs.cs b/PlexRequests.Store/Models/RequestBlobs.cs index 3b1127b6a..f9af75a25 100644 --- a/PlexRequests.Store/Models/RequestBlobs.cs +++ b/PlexRequests.Store/Models/RequestBlobs.cs @@ -34,5 +34,6 @@ namespace PlexRequests.Store.Models public int ProviderId { get; set; } public byte[] Content { get; set; } public RequestType Type { get; set; } + public string MusicId { get; set; } } } \ No newline at end of file diff --git a/PlexRequests.Store/RequestedModel.cs b/PlexRequests.Store/RequestedModel.cs index ffb80db8b..55fc3abac 100644 --- a/PlexRequests.Store/RequestedModel.cs +++ b/PlexRequests.Store/RequestedModel.cs @@ -1,6 +1,4 @@ using System; -using System.Security.Cryptography; - using Dapper.Contrib.Extensions; using System.Collections.Generic; using System.Linq; diff --git a/PlexRequests.Store/SqlTables.sql b/PlexRequests.Store/SqlTables.sql index a35dcf4b7..7392c4efc 100644 --- a/PlexRequests.Store/SqlTables.sql +++ b/PlexRequests.Store/SqlTables.sql @@ -25,7 +25,8 @@ CREATE TABLE IF NOT EXISTS RequestBlobs Id INTEGER PRIMARY KEY AUTOINCREMENT, ProviderId INTEGER NOT NULL, Type INTEGER NOT NULL, - Content BLOB NOT NULL + Content BLOB NOT NULL, + MusicId TEXT ); CREATE UNIQUE INDEX IF NOT EXISTS RequestBlobs_Id ON RequestBlobs (Id); diff --git a/PlexRequests.UI/Modules/SearchModule.cs b/PlexRequests.UI/Modules/SearchModule.cs index 4d97a2cce..81124df26 100644 --- a/PlexRequests.UI/Modules/SearchModule.cs +++ b/PlexRequests.UI/Modules/SearchModule.cs @@ -486,7 +486,7 @@ namespace PlexRequests.UI.Modules MusicBrainzId = albumInfo.id, Overview = albumInfo.disambiguation, PosterPath = img, - Type = RequestType.Album + Type = RequestType.Album, }; // TODO need to send to Headphones