Fixed: Removed json_extract
This commit is contained in:
parent
151c9d8bc4
commit
8f7147d17e
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
|
@ -23,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getUnmonitoredSeasonFilter = conn.CreateCommand())
|
using (var getUnmonitoredSeasonFilter = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getUnmonitoredSeasonFilter.Transaction = tran;
|
getUnmonitoredSeasonFilter.Transaction = tran;
|
||||||
getUnmonitoredSeasonFilter.CommandText = "SELECT \"Id\", \"Filters\" FROM \"CustomFilters\" WHERE EXISTS (SELECT 1 FROM json_each(\"Filters\") AS EACH WHERE json_extract(EACH.value, '$.key') = 'hasUnmonitoredSeason')";
|
getUnmonitoredSeasonFilter.CommandText = "SELECT \"Id\", \"Filters\" FROM \"CustomFilters\"";
|
||||||
|
|
||||||
using (var reader = getUnmonitoredSeasonFilter.ExecuteReader())
|
using (var reader = getUnmonitoredSeasonFilter.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -34,7 +33,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
foreach (var filter in filters)
|
foreach (var filter in filters)
|
||||||
{
|
{
|
||||||
if (filter["key"].ToString() == "hasUnmonitoredSeason")
|
if (filter["key"]?.ToString() == "hasUnmonitoredSeason")
|
||||||
{
|
{
|
||||||
var value = filter["value"].ToString();
|
var value = filter["value"].ToString();
|
||||||
var type = filter["type"].ToString();
|
var type = filter["type"].ToString();
|
||||||
|
@ -70,7 +69,6 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Migrating 210");
|
|
||||||
var updateSql = "UPDATE \"CustomFilters\" SET \"Filters\" = @Filters WHERE \"Id\" = @Id";
|
var updateSql = "UPDATE \"CustomFilters\" SET \"Filters\" = @Filters WHERE \"Id\" = @Id";
|
||||||
conn.Execute(updateSql, updated, transaction: tran);
|
conn.Execute(updateSql, updated, transaction: tran);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue