1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 10:19:41 +00:00

Fixed broken migration 036 for people upgrading from very old DBs

This commit is contained in:
Mark McDowall 2014-10-30 22:26:48 -07:00
parent aadd9243a4
commit 86aba08289

View file

@ -83,14 +83,18 @@ private void ConvertQualityModel(IDbConnection conn, IDbTransaction tran, string
{
var qualityJson = qualityModelReader.GetString(0);
QualityModel036 quality;
SourceQualityModel036 sourceQuality;
if (!Json.TryDeserialize<QualityModel036>(qualityJson, out quality))
if (!Json.TryDeserialize<SourceQualityModel036>(qualityJson, out sourceQuality))
{
continue;
}
var qualityNewJson = qualityModelConverter.ToDB(quality);
var qualityNewJson = qualityModelConverter.ToDB(new DestinationQualityModel036
{
Quality = sourceQuality.Quality.Id,
Proper = sourceQuality.Proper
});
using (IDbCommand updateCmd = conn.CreateCommand())
{
@ -106,10 +110,21 @@ private void ConvertQualityModel(IDbConnection conn, IDbTransaction tran, string
}
}
private class QualityModel036
private class DestinationQualityModel036
{
public Int32 Quality { get; set; }
public Boolean Proper { get; set; }
}
private class SourceQualityModel036
{
public SourceQuality036 Quality { get; set; }
public Boolean Proper { get; set; }
}
private class SourceQuality036
{
public Int32 Id { get; set; }
}
}
}