mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-17 18:30:47 +02:00
Check for event type to prevent multiple runs on the same row
This commit is contained in:
parent
8785fe02e8
commit
20df31919d
1 changed files with 4 additions and 3 deletions
|
|
@ -23,7 +23,7 @@ private void MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran)
|
|||
using (var selectCommand = conn.CreateCommand())
|
||||
{
|
||||
selectCommand.Transaction = tran;
|
||||
selectCommand.CommandText = "SELECT \"Id\", \"Data\" FROM \"History\"";
|
||||
selectCommand.CommandText = "SELECT \"Id\", \"Data\", \"EventType\" FROM \"History\"";
|
||||
|
||||
using var reader = selectCommand.ExecuteReader();
|
||||
|
||||
|
|
@ -31,18 +31,19 @@ private void MigrateHistoryDataTitle(IDbConnection conn, IDbTransaction tran)
|
|||
{
|
||||
var id = reader.GetInt32(0);
|
||||
var data = reader.GetString(1);
|
||||
var eventType = reader.GetInt32(2);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(data))
|
||||
{
|
||||
var jsonObject = Json.Deserialize<JObject>(data);
|
||||
|
||||
if (jsonObject.ContainsKey("title"))
|
||||
if (eventType == 1 && jsonObject.ContainsKey("title"))
|
||||
{
|
||||
jsonObject.Add("grabTitle", jsonObject.Value<string>("title"));
|
||||
jsonObject.Remove("title");
|
||||
}
|
||||
|
||||
if (jsonObject.ContainsKey("bookTitle"))
|
||||
if (eventType != 1 && jsonObject.ContainsKey("bookTitle"))
|
||||
{
|
||||
jsonObject.Add("title", jsonObject.Value<string>("bookTitle"));
|
||||
jsonObject.Remove("bookTitle");
|
||||
|
|
|
|||
Loading…
Reference in a new issue