Standardize string escape in db migrations
This commit is contained in:
parent
87d12a18ab
commit
4bf345dd00
|
@ -8,7 +8,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
protected override void MainDbUpgrade()
|
protected override void MainDbUpgrade()
|
||||||
{
|
{
|
||||||
Execute.Sql(@"UPDATE ""History"" SET ""Data"" = replace( ""Data"", '""Path""', '""ImportedPath""' ) WHERE ""EventType"" = 3");
|
Execute.Sql("UPDATE \"History\" SET \"Data\" = replace( \"Data\", '\"Path\"', '\"ImportedPath\"' ) WHERE \"EventType\" = 3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
protected override void MainDbUpgrade()
|
protected override void MainDbUpgrade()
|
||||||
{
|
{
|
||||||
// we were storing new file name as scene name.
|
// we were storing new file name as scene name.
|
||||||
Execute.Sql(@"UPDATE ""EpisodeFiles"" SET ""SceneName"" = NULL where ""SceneName"" != NULL");
|
Execute.Sql("UPDATE \"EpisodeFiles\" SET \"SceneName\" = NULL where \"SceneName\" != NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var allSeriesCmd = conn.CreateCommand())
|
using (var allSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
allSeriesCmd.Transaction = tran;
|
allSeriesCmd.Transaction = tran;
|
||||||
allSeriesCmd.CommandText = @"SELECT ""Id"" FROM ""Series""";
|
allSeriesCmd.CommandText = "SELECT \"Id\" FROM \"Series\"";
|
||||||
using (var allSeriesReader = allSeriesCmd.ExecuteReader())
|
using (var allSeriesReader = allSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (allSeriesReader.Read())
|
while (allSeriesReader.Read())
|
||||||
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var seasonsCmd = conn.CreateCommand())
|
using (var seasonsCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
seasonsCmd.Transaction = tran;
|
seasonsCmd.Transaction = tran;
|
||||||
seasonsCmd.CommandText = string.Format(@"SELECT ""SeasonNumber"", ""Monitored"" FROM ""Seasons"" WHERE ""SeriesId"" = {0}", seriesId);
|
seasonsCmd.CommandText = $"SELECT \"SeasonNumber\", \"Monitored\" FROM \"Seasons\" WHERE \"SeriesId\" = {seriesId}";
|
||||||
|
|
||||||
using (var seasonReader = seasonsCmd.ExecuteReader())
|
using (var seasonReader = seasonsCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
|
||||||
using (var updateCmd = conn.CreateCommand())
|
using (var updateCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
var text = string.Format("UPDATE \"Series\" SET \"Seasons\" = '{0}' WHERE \"Id\" = {1}", seasons.ToJson(), seriesId);
|
var text = $"UPDATE \"Series\" SET \"Seasons\" = '{seasons.ToJson()}' WHERE \"Id\" = {seriesId}";
|
||||||
|
|
||||||
updateCmd.Transaction = tran;
|
updateCmd.Transaction = tran;
|
||||||
updateCmd.CommandText = text;
|
updateCmd.CommandText = text;
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var namingConfigCmd = conn.CreateCommand())
|
using (var namingConfigCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
namingConfigCmd.Transaction = tran;
|
namingConfigCmd.Transaction = tran;
|
||||||
namingConfigCmd.CommandText = @"SELECT * FROM ""NamingConfig"" LIMIT 1";
|
namingConfigCmd.CommandText = "SELECT * FROM \"NamingConfig\" LIMIT 1";
|
||||||
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
var separatorIndex = namingConfigReader.GetOrdinal("Separator");
|
var separatorIndex = namingConfigReader.GetOrdinal("Separator");
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var namingConfigCmd = conn.CreateCommand())
|
using (var namingConfigCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
namingConfigCmd.Transaction = tran;
|
namingConfigCmd.Transaction = tran;
|
||||||
namingConfigCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'seasonfolderformat'";
|
namingConfigCmd.CommandText = "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'seasonfolderformat'";
|
||||||
var seasonFormat = "Season {season}";
|
var seasonFormat = "Season {season}";
|
||||||
|
|
||||||
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var selectCommand = conn.CreateCommand())
|
using (var selectCommand = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
selectCommand.Transaction = tran;
|
selectCommand.Transaction = tran;
|
||||||
selectCommand.CommandText = @"SELECT * FROM ""Notifications"" WHERE ""ConfigContract"" = 'PushoverSettings'";
|
selectCommand.CommandText = "SELECT * FROM \"Notifications\" WHERE \"ConfigContract\" = 'PushoverSettings'";
|
||||||
|
|
||||||
using (var reader = selectCommand.ExecuteReader())
|
using (var reader = selectCommand.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var qualityProfileCmd = conn.CreateCommand())
|
using (var qualityProfileCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualityProfileCmd.Transaction = tran;
|
qualityProfileCmd.Transaction = tran;
|
||||||
qualityProfileCmd.CommandText = @"SELECT ""Id"", ""Allowed"" FROM ""QualityProfiles""";
|
qualityProfileCmd.CommandText = "SELECT \"Id\", \"Allowed\" FROM \"QualityProfiles\"";
|
||||||
using (var qualityProfileReader = qualityProfileCmd.ExecuteReader())
|
using (var qualityProfileReader = qualityProfileCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualityProfileReader.Read())
|
while (qualityProfileReader.Read())
|
||||||
|
@ -75,7 +75,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var qualityModelCmd = conn.CreateCommand())
|
using (var qualityModelCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualityModelCmd.Transaction = tran;
|
qualityModelCmd.Transaction = tran;
|
||||||
qualityModelCmd.CommandText = @"SELECT Distinct ""Quality"" FROM """ + tableName + "\"";
|
qualityModelCmd.CommandText = $"SELECT Distinct \"Quality\" FROM \"{tableName}\"";
|
||||||
using (var qualityModelReader = qualityModelCmd.ExecuteReader())
|
using (var qualityModelReader = qualityModelCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualityModelReader.Read())
|
while (qualityModelReader.Read())
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var qualitySizeCmd = conn.CreateCommand())
|
using (var qualitySizeCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualitySizeCmd.Transaction = tran;
|
qualitySizeCmd.Transaction = tran;
|
||||||
qualitySizeCmd.CommandText = @"SELECT ""QualityId"", ""MinSize"", ""MaxSize"" FROM ""QualitySizes""";
|
qualitySizeCmd.CommandText = "SELECT \"QualityId\", \"MinSize\", \"MaxSize\" FROM \"QualitySizes\"";
|
||||||
using (var qualitySizeReader = qualitySizeCmd.ExecuteReader())
|
using (var qualitySizeReader = qualitySizeCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (qualitySizeReader.Read())
|
while (qualitySizeReader.Read())
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var configCmd = conn.CreateCommand())
|
using (var configCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
configCmd.Transaction = tran;
|
configCmd.Transaction = tran;
|
||||||
configCmd.CommandText = @"SELECT * FROM ""Config""";
|
configCmd.CommandText = "SELECT * FROM \"Config\"";
|
||||||
using (var configReader = configCmd.ExecuteReader())
|
using (var configReader = configCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
var keyIndex = configReader.GetOrdinal("Key");
|
var keyIndex = configReader.GetOrdinal("Key");
|
||||||
|
|
|
@ -27,13 +27,13 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var cmd = conn.CreateCommand())
|
using (var cmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.Transaction = tran;
|
cmd.Transaction = tran;
|
||||||
cmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'downloadedepisodesfolder'";
|
cmd.CommandText = "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'downloadedepisodesfolder'";
|
||||||
|
|
||||||
var result = cmd.ExecuteScalar();
|
var result = cmd.ExecuteScalar();
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
cmd.CommandText = @"INSERT INTO ""Config"" (""Key"", ""Value"") VALUES ('enablecompleteddownloadhandling', 'True')";
|
cmd.CommandText = "INSERT INTO \"Config\" (\"Key\", \"Value\") VALUES ('enablecompleteddownloadhandling', 'True')";
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var downloadClientsCmd = conn.CreateCommand())
|
using (var downloadClientsCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
downloadClientsCmd.Transaction = tran;
|
downloadClientsCmd.Transaction = tran;
|
||||||
downloadClientsCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'downloadedepisodesfolder'";
|
downloadClientsCmd.CommandText = "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'downloadedepisodesfolder'";
|
||||||
var downloadedEpisodesFolder = downloadClientsCmd.ExecuteScalar() as string;
|
var downloadedEpisodesFolder = downloadClientsCmd.ExecuteScalar() as string;
|
||||||
|
|
||||||
downloadClientsCmd.Transaction = tran;
|
downloadClientsCmd.Transaction = tran;
|
||||||
downloadClientsCmd.CommandText = @"SELECT ""Id"", ""Implementation"", ""Settings"", ""ConfigContract"" FROM ""DownloadClients"" WHERE ""ConfigContract"" = 'FolderSettings'";
|
downloadClientsCmd.CommandText = "SELECT \"Id\", \"Implementation\", \"Settings\", \"ConfigContract\" FROM \"DownloadClients\" WHERE \"ConfigContract\" = 'FolderSettings'";
|
||||||
using (var downloadClientReader = downloadClientsCmd.ExecuteReader())
|
using (var downloadClientReader = downloadClientsCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (downloadClientReader.Read())
|
while (downloadClientReader.Read())
|
||||||
|
@ -141,7 +141,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var historyCmd = conn.CreateCommand())
|
using (var historyCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
historyCmd.Transaction = tran;
|
historyCmd.Transaction = tran;
|
||||||
historyCmd.CommandText = @"SELECT ""Id"", ""EpisodeId"", ""SeriesId"", ""SourceTitle"", ""Date"", ""Data"", ""EventType"" FROM ""History"" WHERE ""EventType"" IS NOT NULL";
|
historyCmd.CommandText = "SELECT \"Id\", \"EpisodeId\", \"SeriesId\", \"SourceTitle\", \"Date\", \"Data\", \"EventType\" FROM \"History\" WHERE \"EventType\" IS NOT NULL";
|
||||||
using (var historyRead = historyCmd.ExecuteReader())
|
using (var historyRead = historyCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (historyRead.Read())
|
while (historyRead.Read())
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getSeriesCmd = conn.CreateCommand())
|
using (var getSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getSeriesCmd.Transaction = tran;
|
getSeriesCmd.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = @"SELECT ""Id"", ""Title"" FROM ""Series""";
|
getSeriesCmd.CommandText = "SELECT \"Id\", \"Title\" FROM \"Series\"";
|
||||||
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getSeriesCmd = conn.CreateCommand())
|
using (var getSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getSeriesCmd.Transaction = tran;
|
getSeriesCmd.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = @"SELECT ""Id"", ""Path"" FROM ""Series""";
|
getSeriesCmd.CommandText = "SELECT \"Id\", \"Path\" FROM \"Series\"";
|
||||||
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var qualityModelCmd = conn.CreateCommand())
|
using (var qualityModelCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
qualityModelCmd.Transaction = tran;
|
qualityModelCmd.Transaction = tran;
|
||||||
qualityModelCmd.CommandText = @"SELECT Distinct ""Quality"" FROM """ + tableName + "\"";
|
qualityModelCmd.CommandText = $"SELECT Distinct \"Quality\" FROM \"{tableName}\"";
|
||||||
|
|
||||||
using (var qualityModelReader = qualityModelCmd.ExecuteReader())
|
using (var qualityModelReader = qualityModelCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getRestictionsCmd = conn.CreateCommand())
|
using (var getRestictionsCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getRestictionsCmd.Transaction = tran;
|
getRestictionsCmd.Transaction = tran;
|
||||||
getRestictionsCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'releaserestrictions'";
|
getRestictionsCmd.CommandText = "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'releaserestrictions'";
|
||||||
|
|
||||||
using (var configReader = getRestictionsCmd.ExecuteReader())
|
using (var configReader = getRestictionsCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var namingConfigCmd = conn.CreateCommand())
|
using (var namingConfigCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
namingConfigCmd.Transaction = tran;
|
namingConfigCmd.Transaction = tran;
|
||||||
namingConfigCmd.CommandText = @"SELECT ""StandardEpisodeFormat"", ""DailyEpisodeFormat"", ""AnimeEpisodeFormat"" FROM ""NamingConfig"" LIMIT 1";
|
namingConfigCmd.CommandText = "SELECT \"StandardEpisodeFormat\", \"DailyEpisodeFormat\", \"AnimeEpisodeFormat\" FROM \"NamingConfig\" LIMIT 1";
|
||||||
|
|
||||||
using (var configReader = namingConfigCmd.ExecuteReader())
|
using (var configReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = conn.CreateCommand())
|
using (var getProfilesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = tran;
|
getProfilesCmd.Transaction = tran;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""GrabDelay"" FROM ""Profiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"GrabDelay\" FROM \"Profiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = _connection.CreateCommand())
|
using (var getProfilesCmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = _transaction;
|
getProfilesCmd.Transaction = _transaction;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""Name"", ""Cutoff"", ""Items"", ""Language"" FROM ""Profiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"Name\", \"Cutoff\", \"Items\", \"Language\" FROM \"Profiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getHistory = conn.CreateCommand())
|
using (var getHistory = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getHistory.Transaction = tran;
|
getHistory.Transaction = tran;
|
||||||
getHistory.CommandText = @"SELECT ""Id"", ""Data"" FROM ""History"" WHERE ""Data"" LIKE '%downloadClientId%'";
|
getHistory.CommandText = "SELECT \"Id\", \"Data\" FROM \"History\" WHERE \"Data\" LIKE '%downloadClientId%'";
|
||||||
|
|
||||||
using (var historyReader = getHistory.ExecuteReader())
|
using (var historyReader = getHistory.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var tagCmd = conn.CreateCommand())
|
using (var tagCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
tagCmd.Transaction = tran;
|
tagCmd.Transaction = tran;
|
||||||
tagCmd.CommandText = @"SELECT ""Id"", ""Label"" FROM ""Tags""";
|
tagCmd.CommandText = "SELECT \"Id\", \"Label\" FROM \"Tags\"";
|
||||||
|
|
||||||
using (var tagReader = tagCmd.ExecuteReader())
|
using (var tagReader = tagCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
Id = t.Id
|
Id = t.Id
|
||||||
});
|
});
|
||||||
|
|
||||||
var updateTagsSql = string.Format(@"UPDATE ""{0}"" SET ""Tags"" = @Tags WHERE ""Id"" = @Id", table);
|
var updateTagsSql = $"UPDATE \"{table}\" SET \"Tags\" = @Tags WHERE \"Id\" = @Id";
|
||||||
conn.Execute(updateTagsSql, updatedTags, transaction: tran);
|
conn.Execute(updateTagsSql, updatedTags, transaction: tran);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var removeCmd = conn.CreateCommand())
|
using (var removeCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
removeCmd.Transaction = tran;
|
removeCmd.Transaction = tran;
|
||||||
removeCmd.CommandText = string.Format("DELETE FROM \"Tags\" WHERE \"Id\" IN ({0})", string.Join(", ", idsToRemove));
|
removeCmd.CommandText = $"DELETE FROM \"Tags\" WHERE \"Id\" IN ({string.Join(", ", idsToRemove)})";
|
||||||
removeCmd.ExecuteNonQuery();
|
removeCmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfileCmd = conn.CreateCommand())
|
using (var getProfileCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfileCmd.Transaction = tran;
|
getProfileCmd.Transaction = tran;
|
||||||
getProfileCmd.CommandText = @"SELECT ""Id"", ""Language"" FROM ""Profiles""";
|
getProfileCmd.CommandText = "SELECT \"Id\", \"Language\" FROM \"Profiles\"";
|
||||||
|
|
||||||
using (var profilesReader = getProfileCmd.ExecuteReader())
|
using (var profilesReader = getProfileCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getSeriesCmd = conn.CreateCommand())
|
using (var getSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getSeriesCmd.Transaction = tran;
|
getSeriesCmd.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = @"SELECT ""Id"", ""ProfileId"" FROM ""Series""";
|
getSeriesCmd.CommandText = "SELECT \"Id\", \"ProfileId\" FROM \"Series\"";
|
||||||
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = conn.CreateCommand())
|
using (var getProfilesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = tran;
|
getProfilesCmd.Transaction = tran;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""Language"" FROM ""Profiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"Language\" FROM \"Profiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = _connection.CreateCommand())
|
using (var getProfilesCmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = _transaction;
|
getProfilesCmd.Transaction = _transaction;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""Name"", ""Cutoff"", ""Items"" FROM ""Profiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"Name\", \"Cutoff\", \"Items\" FROM \"Profiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = _connection.CreateCommand())
|
using (var getProfilesCmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = _transaction;
|
getProfilesCmd.Transaction = _transaction;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""Name"", ""Cutoff"", ""Items"" FROM ""Profiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"Name\", \"Cutoff\", \"Items\" FROM \"Profiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getFileChmodCmd = conn.CreateCommand())
|
using (var getFileChmodCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getFileChmodCmd.Transaction = tran;
|
getFileChmodCmd.Transaction = tran;
|
||||||
getFileChmodCmd.CommandText = @"SELECT ""Value"" FROM ""Config"" WHERE ""Key"" = 'filechmod'";
|
getFileChmodCmd.CommandText = "SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'filechmod'";
|
||||||
|
|
||||||
if (getFileChmodCmd.ExecuteScalar() is string fileChmod)
|
if (getFileChmodCmd.ExecuteScalar() is string fileChmod)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = _connection.CreateCommand())
|
using (var getProfilesCmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = _transaction;
|
getProfilesCmd.Transaction = _transaction;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""Name"", ""Languages"", ""UpgradeAllowed"", ""Cutoff"" FROM ""LanguageProfiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"Name\", \"Languages\", \"UpgradeAllowed\", \"Cutoff\" FROM \"LanguageProfiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getSeriesCmd = conn.CreateCommand())
|
using (var getSeriesCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getSeriesCmd.Transaction = tran;
|
getSeriesCmd.Transaction = tran;
|
||||||
getSeriesCmd.CommandText = @"SELECT ""Id"", ""TvdbId"", ""Title"" FROM ""Series""";
|
getSeriesCmd.CommandText = "SELECT \"Id\", \"TvdbId\", \"Title\" FROM \"Series\"";
|
||||||
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
using (var seriesReader = getSeriesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (seriesReader.Read())
|
while (seriesReader.Read())
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfilesCmd = _connection.CreateCommand())
|
using (var getProfilesCmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfilesCmd.Transaction = _transaction;
|
getProfilesCmd.Transaction = _transaction;
|
||||||
getProfilesCmd.CommandText = @"SELECT ""Id"", ""Name"", ""Languages"", ""UpgradeAllowed"", ""Cutoff"" FROM ""LanguageProfiles""";
|
getProfilesCmd.CommandText = "SELECT \"Id\", \"Name\", \"Languages\", \"UpgradeAllowed\", \"Cutoff\" FROM \"LanguageProfiles\"";
|
||||||
|
|
||||||
using (var profileReader = getProfilesCmd.ExecuteReader())
|
using (var profileReader = getProfilesCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfiles = conn.CreateCommand())
|
using (var getProfiles = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfiles.Transaction = tran;
|
getProfiles.Transaction = tran;
|
||||||
getProfiles.CommandText = @"SELECT ""Id"" FROM ""QualityProfiles""";
|
getProfiles.CommandText = "SELECT \"Id\" FROM \"QualityProfiles\"";
|
||||||
|
|
||||||
using (var definitionsReader = getProfiles.ExecuteReader())
|
using (var definitionsReader = getProfiles.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var getProfiles = conn.CreateCommand())
|
using (var getProfiles = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
getProfiles.Transaction = tran;
|
getProfiles.Transaction = tran;
|
||||||
getProfiles.CommandText = @"SELECT ""Id"", ""Name"" FROM ""CustomFormats""";
|
getProfiles.CommandText = "SELECT \"Id\", \"Name\" FROM \"CustomFormats\"";
|
||||||
|
|
||||||
using (var definitionsReader = getProfiles.ExecuteReader())
|
using (var definitionsReader = getProfiles.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
@ -189,7 +189,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
using (var namingConfigCmd = conn.CreateCommand())
|
using (var namingConfigCmd = conn.CreateCommand())
|
||||||
{
|
{
|
||||||
namingConfigCmd.Transaction = tran;
|
namingConfigCmd.Transaction = tran;
|
||||||
namingConfigCmd.CommandText = @"SELECT * FROM ""NamingConfig"" LIMIT 1";
|
namingConfigCmd.CommandText = "SELECT * FROM \"NamingConfig\" LIMIT 1";
|
||||||
|
|
||||||
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
using (var namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,8 +8,8 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
{
|
{
|
||||||
protected override void MainDbUpgrade()
|
protected override void MainDbUpgrade()
|
||||||
{
|
{
|
||||||
IfDatabase("sqlite").Execute.Sql(@"DELETE FROM ""MetadataFiles"" WHERE ""Consumer"" = 'RoksboxMetadata' AND ""Type"" = 5 AND (""RelativePath"" LIKE '%/metadata/%' OR ""RelativePath"" LIKE '%\metadata\%')");
|
IfDatabase("sqlite").Execute.Sql("DELETE FROM \"MetadataFiles\" WHERE \"Consumer\" = 'RoksboxMetadata' AND \"Type\" = 5 AND (\"RelativePath\" LIKE '%/metadata/%' OR \"RelativePath\" LIKE '%\\metadata\\%')");
|
||||||
IfDatabase("postgresql").Execute.Sql(@"DELETE FROM ""MetadataFiles"" WHERE ""Consumer"" = 'RoksboxMetadata' AND ""Type"" = 5 AND (""RelativePath"" LIKE '%/metadata/%' OR ""RelativePath"" LIKE '%\\metadata\\%')");
|
IfDatabase("postgresql").Execute.Sql("DELETE FROM \"MetadataFiles\" WHERE \"Consumer\" = 'RoksboxMetadata' AND \"Type\" = 5 AND (\"RelativePath\" LIKE '%/metadata/%' OR \"RelativePath\" LIKE '%\\\\metadata\\\\%')");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue