mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: Migration failing and thus making Radarr unable to start.
This commit is contained in:
parent
0d40ed7ec0
commit
17387c8b50
@ -34,39 +34,6 @@ protected override void MainDbUpgrade()
|
|||||||
|
|
||||||
Alter.Table("Movies").AddColumn("SecondaryYear").AsInt32().Nullable();
|
Alter.Table("Movies").AddColumn("SecondaryYear").AsInt32().Nullable();
|
||||||
Alter.Table("Movies").AddColumn("SecondaryYearSourceId").AsInt64().Nullable().WithDefault(0);
|
Alter.Table("Movies").AddColumn("SecondaryYearSourceId").AsInt64().Nullable().WithDefault(0);
|
||||||
|
|
||||||
Execute.WithConnection(AddExisting);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddExisting(IDbConnection conn, IDbTransaction tran)
|
|
||||||
{
|
|
||||||
using (IDbCommand getSeriesCmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
getSeriesCmd.Transaction = tran;
|
|
||||||
getSeriesCmd.CommandText = @"SELECT Key, Value FROM Config WHERE Key = 'importexclusions'";
|
|
||||||
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
|
|
||||||
using (IDataReader seriesReader = getSeriesCmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (seriesReader.Read())
|
|
||||||
{
|
|
||||||
var Key = seriesReader.GetString(0);
|
|
||||||
var Value = seriesReader.GetString(1);
|
|
||||||
|
|
||||||
var importExclusions = Value.Split(',').Select(x => {
|
|
||||||
return string.Format("(\"{0}\", \"{1}\")", Regex.Replace(x, @"^.*\-(.*)$", "$1"),
|
|
||||||
textInfo.ToTitleCase(string.Join(" ", x.Split('-').DropLast(1))));
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
updateCmd.Transaction = tran;
|
|
||||||
updateCmd.CommandText = "INSERT INTO ImportExclusions (tmdbid, MovieTitle) VALUES " + string.Join(", ", importExclusions);
|
|
||||||
|
|
||||||
updateCmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user