Change the new columns type

This commit is contained in:
tidusjar 2016-04-01 22:17:15 +01:00
parent 425302ba12
commit 420e43dfaf
6 changed files with 6 additions and 6 deletions

View file

@ -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 // 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; 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); var result = Repo.Update(entity);
return result ? id : -1; return result ? id : -1;

View file

@ -80,7 +80,7 @@ namespace PlexRequests.Core
connection.UpdateSchemaVersion(SchemaVersion); connection.UpdateSchemaVersion(SchemaVersion);
try try
{ {
TableCreation.AlterTable(Db.DbConnection(), "RequestBlobs", "ADD COLUMN", "MusicId", false, "INTEGER"); TableCreation.AlterTable(Db.DbConnection(), "RequestBlobs", "ADD COLUMN", "MusicId", false, "TEXT");
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -34,5 +34,6 @@ namespace PlexRequests.Store.Models
public int ProviderId { get; set; } public int ProviderId { get; set; }
public byte[] Content { get; set; } public byte[] Content { get; set; }
public RequestType Type { get; set; } public RequestType Type { get; set; }
public string MusicId { get; set; }
} }
} }

View file

@ -1,6 +1,4 @@
using System; using System;
using System.Security.Cryptography;
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View file

@ -25,7 +25,8 @@ CREATE TABLE IF NOT EXISTS RequestBlobs
Id INTEGER PRIMARY KEY AUTOINCREMENT, Id INTEGER PRIMARY KEY AUTOINCREMENT,
ProviderId INTEGER NOT NULL, ProviderId INTEGER NOT NULL,
Type 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); CREATE UNIQUE INDEX IF NOT EXISTS RequestBlobs_Id ON RequestBlobs (Id);

View file

@ -486,7 +486,7 @@ namespace PlexRequests.UI.Modules
MusicBrainzId = albumInfo.id, MusicBrainzId = albumInfo.id,
Overview = albumInfo.disambiguation, Overview = albumInfo.disambiguation,
PosterPath = img, PosterPath = img,
Type = RequestType.Album Type = RequestType.Album,
}; };
// TODO need to send to Headphones // TODO need to send to Headphones