Fix newznab redirect database migration

(cherry picked from commit f67bc52f85fa0677f4cda5b7b7dcb30dfe31468a)
This commit is contained in:
Bogdan 2025-10-29 19:46:29 +02:00 committed by bakerboy448
parent e4fb36e08f
commit 0ef9f4c869

View file

@ -1,5 +1,3 @@
using System.Data;
using Dapper;
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
@ -10,13 +8,7 @@ public class newznab_indexers_enable_redirect : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Execute.WithConnection(UpdateNewznabRedirectSetting);
}
private void UpdateNewznabRedirectSetting(IDbConnection conn, IDbTransaction tran)
{
var updateSql = "UPDATE \"Indexers\" SET \"Redirect\" = @Redirect WHERE \"Implementation\" = 'Newznab' AND \"Redirect\" = false";
conn.Execute(updateSql, new { Redirect = true }, transaction: tran);
Update.Table("Indexers").Set(new { Redirect = true }).Where(new { Implementation = "Newznab", Redirect = false });
}
}
}