mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
parent
0a1ea0019d
commit
9b2aef2ca2
1 changed files with 9 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Dapper;
|
||||||
using FluentMigrator;
|
using FluentMigrator;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
|
@ -62,20 +63,16 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
public void Commit()
|
public void Commit()
|
||||||
{
|
{
|
||||||
foreach (var profile in _changedProfiles)
|
var profilesToUpdate = _changedProfiles.Select(p => new
|
||||||
{
|
{
|
||||||
using (var updateProfileCmd = _connection.CreateCommand())
|
p.Id,
|
||||||
{
|
p.Name,
|
||||||
updateProfileCmd.Transaction = _transaction;
|
p.Cutoff,
|
||||||
updateProfileCmd.CommandText = "UPDATE \"QualityProfiles\" SET \"Name\" = ?, \"Cutoff\" = ?, \"Items\" = ? WHERE \"Id\" = ?";
|
Items = p.Items.ToJson()
|
||||||
updateProfileCmd.AddParameter(profile.Name);
|
});
|
||||||
updateProfileCmd.AddParameter(profile.Cutoff);
|
|
||||||
updateProfileCmd.AddParameter(profile.Items.ToJson());
|
|
||||||
updateProfileCmd.AddParameter(profile.Id);
|
|
||||||
|
|
||||||
updateProfileCmd.ExecuteNonQuery();
|
var updateSql = "UPDATE \"QualityProfiles\" SET \"Name\" = @Name, \"Cutoff\" = @Cutoff, \"Items\" = @Items WHERE \"Id\" = @Id";
|
||||||
}
|
_connection.Execute(updateSql, profilesToUpdate, transaction: _transaction);
|
||||||
}
|
|
||||||
|
|
||||||
_changedProfiles.Clear();
|
_changedProfiles.Clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue