From a13011aa490ff8a6df52676de9fdc3bd7c15176e Mon Sep 17 00:00:00 2001
From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com>
Date: Wed, 26 Jan 2022 00:08:27 +0000
Subject: [PATCH] New: Postgres Database Support
Co-Authored-By: Qstick <376117+Qstick@users.noreply.github.com>
---
frontend/src/System/Status/About/About.js | 9 +
src/NuGet.Config | 1 +
.../AutomationTest.cs | 2 +-
.../CleanseLogMessageFixture.cs | 18 +
.../ServiceFactoryFixture.cs | 5 +-
.../Instrumentation/CleanseLogMessage.cs | 1 +
.../Datastore/DatabaseFixture.cs | 16 +-
.../Datastore/DatabaseRelationshipFixture.cs | 12 +
.../Migration/070_delay_profileFixture.cs | 20 +-
.../071_unknown_quality_in_profileFixture.cs | 13 +-
.../072_history_downloadIdFixture.cs | 8 +-
.../Migration/075_force_lib_updateFixture.cs | 38 +-
.../Migration/079_dedupe_tagsFixture.cs | 62 +--
..._prefix_to_transmission_categoryFixture.cs | 14 +-
.../084_update_quality_minmax_sizeFixture.cs | 10 +-
.../085_expand_transmission_urlbaseFixture.cs | 14 +-
.../086_pushbullet_device_idsFixture.cs | 8 +-
...pushbullet_devices_channels_listFixture.cs | 4 +-
.../090_update_kickass_urlFixture.cs | 6 +-
.../099_extra_and_subtitle_filesFixture.cs | 4 +-
..._add_ultrahd_quality_in_profilesFixture.cs | 2 +-
...103_fix_metadata_file_extensionsFixture.cs | 4 +-
.../Migration/106_update_btn_urlFixture.cs | 6 +-
...108_fix_metadata_file_extensionsFixture.cs | 6 +-
.../109_import_extra_files_configFixture.cs | 6 +-
.../110_fix_extra_files_configFixture.cs | 20 +-
...7_add_webrip_qualites_in_profileFixture.cs | 8 +-
.../121_update_animetosho_urlFixture.cs | 2 +-
...2_add_remux_qualities_in_profileFixture.cs | 4 +-
...ity_profiles_add_upgrade_allowedFixture.cs | 4 +-
...132_add_download_client_priorityFixture.cs | 20 +-
...148_mediainfo_channel_propertiesFixture.cs | 2 +-
.../157_email_multiple_addressesFixture.cs | 2 +-
.../158_cdh_per_downloadclientFixture.cs | 12 +-
.../161_fix_pending_releasesFixture.cs | 6 +-
.../171_add_custom_formatsFixture.cs | 30 +-
..._invalid_roksbox_metadata_imagesFixture.cs | 2 +-
.../192_import_exclusion_typeFixture.cs | 4 +-
...ture.cs => WhereBuilderPostgresFixture.cs} | 30 +-
.../Datastore/WhereBuilderSqliteFixture.cs | 198 +++++++++
src/NzbDrone.Core.Test/Framework/DbTest.cs | 56 ++-
.../Framework/DbTestCleanup.cs | 6 +-
.../Framework/TestDatabase.cs | 3 +
.../SeriesStatisticsFixture.cs | 6 +-
src/NzbDrone.Core/Backup/BackupService.cs | 7 +-
.../Blocklisting/BlocklistRepository.cs | 2 +-
.../Configuration/ConfigFileProvider.cs | 21 +-
.../Datastore/BasicRepository.cs | 21 +-
.../Datastore/ConnectionStringFactory.cs | 61 ++-
src/NzbDrone.Core/Datastore/Database.cs | 34 +-
.../Datastore/DatabaseConnectionInfo.cs | 14 +
src/NzbDrone.Core/Datastore/DbFactory.cs | 62 ++-
.../Datastore/Extensions/BuilderExtensions.cs | 46 ++-
src/NzbDrone.Core/Datastore/LogDatabase.cs | 4 +
src/NzbDrone.Core/Datastore/MainDatabase.cs | 4 +
.../007_add_renameEpisodes_to_naming.cs | 4 +-
.../Migration/009_fix_renameEpisodes.cs | 6 +-
.../Datastore/Migration/010_add_monitored.cs | 10 +-
.../Migration/013_add_air_date_utc.cs | 4 +-
.../016_updated_imported_history_item.cs | 4 +-
.../Migration/017_reset_scene_names.cs | 4 +-
.../Migration/018_remove_duplicates.cs | 18 +-
.../020_add_year_and_seasons_to_series.cs | 6 +-
.../029_add_formats_to_naming_config.cs | 8 +-
...d_season_folder_format_to_naming_config.cs | 10 +-
.../032_set_default_release_group.cs | 5 +-
.../Migration/033_add_api_key_to_pushover.cs | 8 +-
...d_series_folder_format_to_naming_config.cs | 4 +-
.../036_update_with_quality_converters.cs | 8 +-
.../037_add_configurable_qualities.cs | 4 +-
.../038_add_on_upgrade_to_notifications.cs | 4 +-
.../041_fix_xbmc_season_images_metadata.cs | 4 +-
.../043_convert_config_to_download_clients.cs | 6 +-
.../044_fix_xbmc_episode_metadata.cs | 24 +-
.../Datastore/Migration/046_fix_nzb_su_url.cs | 8 +-
.../Datastore/Migration/049_fix_dognzb_url.cs | 8 +-
.../Migration/051_download_client_import.cs | 18 +-
.../Migration/052_add_columns_for_anime.cs | 6 +-
.../Migration/053_add_series_sorttitle.cs | 4 +-
.../Migration/054_rename_profiles.cs | 6 +-
...7_convert_episode_file_path_to_relative.cs | 4 +-
.../059_add_enable_options_to_indexers.cs | 6 +-
.../Migration/061_clear_bad_scene_names.cs | 18 +-
.../Migration/062_convert_quality_models.cs | 4 +-
.../065_make_scene_numbering_nullable.cs | 9 +-
.../Datastore/Migration/066_add_tags.cs | 6 +-
.../Migration/068_add_release_restrictions.cs | 6 +-
.../Datastore/Migration/069_quality_proper.cs | 4 +-
.../Datastore/Migration/070_delay_profile.cs | 61 +--
.../071_unknown_quality_in_profile.cs | 25 +-
.../Datastore/Migration/072_history_grabid.cs | 38 +-
.../Datastore/Migration/074_disable_eztv.cs | 4 +-
.../Datastore/Migration/079_dedupe_tags.cs | 32 +-
...ove_dot_prefix_to_transmission_category.cs | 22 +-
.../Migration/082_add_fanzub_settings.cs | 4 +-
.../084_update_quality_minmax_size.cs | 4 +-
.../085_expand_transmission_urlbase.cs | 22 +-
.../Migration/086_pushbullet_device_ids.cs | 20 +-
.../Datastore/Migration/087_remove_eztv.cs | 4 +-
.../088_pushbullet_devices_channels_list.cs | 22 +-
.../089_add_on_rename_to_notifcations.cs | 8 +-
.../Migration/090_update_kickass_url.cs | 8 +-
.../Migration/096_disable_kickass.cs | 4 +-
.../Migration/099_extra_and_subtitle_files.cs | 25 +-
...e_to_episodeFiles_history_and_blacklist.cs | 36 +-
.../103_fix_metadata_file_extensions.cs | 23 +-
.../Datastore/Migration/104_remove_kickass.cs | 4 +-
.../105_rename_torrent_downloadstation.cs | 4 +-
.../Datastore/Migration/106_update_btn_url.cs | 2 +-
.../Datastore/Migration/107_remove_wombles.cs | 4 +-
.../Migration/108_fix_extra_file_extension.cs | 25 +-
.../Migration/109_import_extra_files.cs | 28 +-
.../Migration/110_fix_extra_files_config.cs | 10 +-
.../Migration/111_create_language_profiles.cs | 6 +-
.../113_consolidate_indexer_baseurl.cs | 4 +-
.../Datastore/Migration/116_disable_nyaa.cs | 4 +-
...dd_webrip_and_br480_qualites_in_profile.cs | 24 +-
...rate_automatic_and_interactive_searches.cs | 2 +-
.../Migration/121_update_animetosho_url.cs | 2 +-
.../122_add_remux_qualities_in_profile.cs | 23 +-
...me_quality_profiles_add_upgrade_allowed.cs | 4 +-
.../Migration/131_download_propers_config.cs | 6 +-
.../132_add_download_client_priority.cs | 53 ++-
.../134_add_specials_folder_format.cs | 15 +-
.../135_health_issue_notification.cs | 6 +-
.../Datastore/Migration/138_remove_bitmetv.cs | 6 +-
.../Migration/139_add_download_history.cs | 2 +-
...140_remove_chown_and_folderchmod_config.cs | 2 +-
.../146_cleanup_duplicates_updatehistory.cs | 6 +-
.../147_swap_filechmod_for_folderchmod.cs | 8 +-
.../Migration/148_mediainfo_channels.cs | 4 +-
.../149_add_on_delete_to_notifications.cs | 6 +-
.../Migration/152_update_btn_url_to_https.cs | 2 +-
...53_add_on_episodefiledelete_for_upgrade.cs | 4 +-
.../155_add_arabic_and_hindi_languages.cs | 4 +-
.../156_add_bypass_to_delay_profile.cs | 2 +-
.../Migration/157_email_multiple_addresses.cs | 20 +-
.../Migration/158_cdh_per_downloadclient.cs | 19 +-
.../Migration/161_remove_plex_hometheater.cs | 4 +-
.../Migration/162_release_profile_to_array.cs | 4 +-
.../Migration/163_mediainfo_to_ffmpeg.cs | 4 +-
.../165_add_on_update_to_notifications.cs | 2 +-
.../Migration/166_update_series_sort_title.cs | 4 +-
..._add_malayalam _and_ukrainian_languages.cs | 4 +-
.../Migration/171_add_custom_formats.cs | 41 +-
.../Datastore/Migration/173_remove_omg.cs | 2 +-
...175_language_profiles_to_custom_formats.cs | 6 +-
.../181_quality_definition_preferred_size.cs | 2 +-
.../Migration/183_update_images_remote_url.cs | 4 +-
..._remove_invalid_roksbox_metadata_images.cs | 3 +-
.../187_add_on_series_add_to_notifications.cs | 2 +-
...date_timestamp_columns_to_with_timezone.cs | 55 +++
.../190_health_restored_notification.cs | 2 +-
.../Migration/192_import_exclusion_type.cs | 5 +-
.../Framework/MigrationController.cs | 16 +-
.../Datastore/PostgresOptions.cs | 26 ++
src/NzbDrone.Core/Datastore/SqlBuilder.cs | 8 +
src/NzbDrone.Core/Datastore/TableMapper.cs | 37 +-
src/NzbDrone.Core/Datastore/TableMapping.cs | 2 +-
src/NzbDrone.Core/Datastore/WhereBuilder.cs | 384 +----------------
.../Datastore/WhereBuilderPostgres.cs | 389 ++++++++++++++++++
.../Datastore/WhereBuilderSqlite.cs | 389 ++++++++++++++++++
.../History/HistoryRepository.cs | 2 +-
.../CleanupAbsolutePathMetadataFiles.cs | 38 +-
.../CleanupAdditionalNamingSpecs.cs | 10 +-
.../Housekeepers/CleanupAdditionalUsers.cs | 10 +-
...ownloadClientUnavailablePendingReleases.cs | 35 +-
.../CleanupDuplicateMetadataFiles.cs | 42 +-
.../Housekeepers/CleanupOrphanedBlocklist.cs | 14 +-
.../CleanupOrphanedDownloadClientStatus.cs | 15 +-
.../CleanupOrphanedEpisodeFiles.cs | 12 +-
.../Housekeepers/CleanupOrphanedEpisodes.cs | 12 +-
.../CleanupOrphanedHistoryItems.cs | 24 +-
.../CleanupOrphanedImportListStatus.cs | 12 +-
.../CleanupOrphanedIndexerStatus.cs | 14 +-
.../CleanupOrphanedMetadataFiles.cs | 36 +-
.../CleanupOrphanedPendingReleases.cs | 12 +-
.../Housekeepers/CleanupUnusedTags.cs | 11 +-
.../FixFutureRunScheduledTasks.cs | 10 +-
.../Instrumentation/DatabaseTarget.cs | 70 +++-
.../Messaging/Commands/CommandRepository.cs | 2 +-
.../SeriesStats/SeriesStatisticsRepository.cs | 44 +-
src/NzbDrone.Core/Sonarr.Core.csproj | 6 +-
src/NzbDrone.Core/Tv/EpisodeRepository.cs | 17 +-
src/NzbDrone.Core/Tv/SeriesRepository.cs | 11 +-
.../Update/UpdatePackageProvider.cs | 6 +-
src/NzbDrone.Host.Test/ContainerFixture.cs | 3 +
src/NzbDrone.Host/Bootstrap.cs | 8 +
.../IntegrationTest.cs | 30 +-
.../Datastore/PostgresDatabase.cs | 69 ++++
.../Datastore/SqliteDatabase.cs | 14 +
src/NzbDrone.Test.Common/NzbDroneRunner.cs | 23 +-
src/Sonarr.Api.V3/System/SystemController.cs | 3 +-
src/Sonarr.Api.V3/System/SystemResource.cs | 3 +
src/postgres.runsettings | 11 +
195 files changed, 2600 insertions(+), 1325 deletions(-)
rename src/NzbDrone.Core.Test/Datastore/{WhereBuilderFixture.cs => WhereBuilderPostgresFixture.cs} (88%)
create mode 100644 src/NzbDrone.Core.Test/Datastore/WhereBuilderSqliteFixture.cs
create mode 100644 src/NzbDrone.Core/Datastore/DatabaseConnectionInfo.cs
create mode 100644 src/NzbDrone.Core/Datastore/Migration/188_postgres_update_timestamp_columns_to_with_timezone.cs
create mode 100644 src/NzbDrone.Core/Datastore/PostgresOptions.cs
create mode 100644 src/NzbDrone.Core/Datastore/WhereBuilderPostgres.cs
create mode 100644 src/NzbDrone.Core/Datastore/WhereBuilderSqlite.cs
create mode 100644 src/NzbDrone.Test.Common/Datastore/PostgresDatabase.cs
create mode 100644 src/NzbDrone.Test.Common/Datastore/SqliteDatabase.cs
create mode 100644 src/postgres.runsettings
diff --git a/frontend/src/System/Status/About/About.js b/frontend/src/System/Status/About/About.js
index b0b289135..7cd66edf2 100644
--- a/frontend/src/System/Status/About/About.js
+++ b/frontend/src/System/Status/About/About.js
@@ -22,6 +22,8 @@ class About extends Component {
isNetCore,
isDocker,
runtimeVersion,
+ databaseVersion,
+ databaseType,
appData,
startupPath,
mode,
@@ -69,6 +71,11 @@ class About extends Component {
/>
}
+
+
+
\ No newline at end of file
diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs
index 37996477f..799670e31 100644
--- a/src/NzbDrone.Automation.Test/AutomationTest.cs
+++ b/src/NzbDrone.Automation.Test/AutomationTest.cs
@@ -43,7 +43,7 @@ namespace NzbDrone.Automation.Test
driver.Manage().Window.Size = new System.Drawing.Size(1920, 1080);
- _runner = new NzbDroneRunner(LogManager.GetCurrentClassLogger());
+ _runner = new NzbDroneRunner(LogManager.GetCurrentClassLogger(), null);
_runner.KillAll();
_runner.Start(true);
diff --git a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs
index 59407f4dd..388a96635 100644
--- a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs
+++ b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs
@@ -66,6 +66,9 @@ namespace NzbDrone.Common.Test.InstrumentationTests
[TestCase("Hardlinking episode file: /Users/mySecret/Downloads to /media/abc.mkv")]
[TestCase("Hardlink '/home/mySecret/Downloads/abs.mkv' to '/media/abc.mkv' failed.")]
[TestCase("Hardlink '/Users/mySecret/Downloads/abs.mkv' to '/media/abc.mkv' failed.")]
+ [TestCase("/sonarr/signalr/messages/negotiate?access_token=1234530f422f4aacb6b301233210aaaa&negotiateVersion=1")]
+ [TestCase(@"[Info] MigrationController: *** Migrating Database=sonarr-main;Host=postgres14;Username=mySecret;Password=mySecret;Port=5432;Enlist=False ***")]
+ [TestCase(@"[Info] MigrationController: *** Migrating Database=sonarr-main;Host=postgres14;Username=mySecret;Password=mySecret;Port=5432;token=mySecret;Enlist=False&username=mySecret;mypassword=mySecret;mypass=shouldkeep1;test_token=mySecret;password=123%@%_@!#^#@;use_password=mySecret;get_token=shouldkeep2;usetoken=shouldkeep3;passwrd=mySecret;")]
// Announce URLs (passkeys) Magnet & Tracker
[TestCase(@"magnet_uri"":""magnet:?xt=urn:btih:9pr04sgkillroyimaveql2tyu8xyui&dn=&tr=https%3a%2f%2fxxx.yyy%2f9pr04sg601233210imaveql2tyu8xyui%2fannounce""}")]
@@ -90,9 +93,24 @@ namespace NzbDrone.Common.Test.InstrumentationTests
var cleansedMessage = CleanseLogMessage.Cleanse(message);
cleansedMessage.Should().NotContain("mySecret");
+ cleansedMessage.Should().NotContain("123%@%_@!#^#@");
cleansedMessage.Should().NotContain("01233210");
}
+ [TestCase(@"[Info] MigrationController: *** Migrating Database=sonarr-main;Host=postgres14;Username=mySecret;Password=mySecret;Port=5432;token=mySecret;Enlist=False&username=mySecret;mypassword=mySecret;mypass=shouldkeep1;test_token=mySecret;password=123%@%_@!#^#@;use_password=mySecret;get_token=shouldkeep2;usetoken=shouldkeep3;passwrd=mySecret;")]
+ public void should_keep_message(string message)
+ {
+ var cleansedMessage = CleanseLogMessage.Cleanse(message);
+
+ cleansedMessage.Should().NotContain("mySecret");
+ cleansedMessage.Should().NotContain("123%@%_@!#^#@");
+ cleansedMessage.Should().NotContain("01233210");
+
+ cleansedMessage.Should().Contain("shouldkeep1");
+ cleansedMessage.Should().Contain("shouldkeep2");
+ cleansedMessage.Should().Contain("shouldkeep3");
+ }
+
[TestCase(@"Some message (from 32.2.3.5 user agent)")]
[TestCase(@"Auth-Invalidated ip 32.2.3.5")]
[TestCase(@"Auth-Success ip 32.2.3.5")]
diff --git a/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs
index f543af256..58642f2e4 100644
--- a/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs
+++ b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs
@@ -4,11 +4,13 @@ using DryIoc.Microsoft.DependencyInjection;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Composition.Extensions;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Instrumentation.Extensions;
+using NzbDrone.Core.Datastore;
using NzbDrone.Core.Datastore.Extensions;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
@@ -29,7 +31,8 @@ namespace NzbDrone.Common.Test
.AddDummyDatabase()
.AddStartupContext(new StartupContext("first", "second"));
- container.RegisterInstance(new Mock().Object);
+ container.RegisterInstance(new Mock().Object);
+ container.RegisterInstance(new Mock>().Object);
var serviceProvider = container.GetServiceProvider();
diff --git a/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs b/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs
index defe1bde0..d0150a7bc 100644
--- a/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs
+++ b/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs
@@ -17,6 +17,7 @@ namespace NzbDrone.Common.Instrumentation
new (@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"/fetch/[a-z0-9]{32}/(?[a-z0-9]{32})", RegexOptions.Compiled),
new (@"getnzb.*?(?<=\?|&)(r)=(?[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
+ new (@"\b(\w*)?(_?(?[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Trackers Announce Keys; Designed for Qbit Json; should work for all in theory
new (@"announce(\.php)?(/|%2f|%3fpasskey%3d)(?[a-z0-9]{16,})|(?[a-z0-9]{16,})(/|%2f)announce"),
diff --git a/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs b/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs
index 19631c00c..b24765caf 100644
--- a/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs
+++ b/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.Datastore
public void SingleOrDefault_should_return_null_on_empty_db()
{
Mocker.Resolve()
- .OpenConnection().Query("SELECT * FROM Series")
+ .OpenConnection().Query("SELECT * FROM \"Series\"")
.SingleOrDefault()
.Should()
.BeNull();
@@ -27,6 +27,20 @@ namespace NzbDrone.Core.Test.Datastore
Mocker.Resolve().Vacuum();
}
+ [Test]
+ public void postgres_should_not_contain_timestamp_without_timezone_columns()
+ {
+ if (Db.DatabaseType != DatabaseType.PostgreSQL)
+ {
+ return;
+ }
+
+ Mocker.Resolve()
+ .OpenConnection().Query("SELECT table_name, column_name, data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'public' AND data_type = 'timestamp without time zone'")
+ .Should()
+ .BeNullOrEmpty();
+ }
+
[Test]
public void get_version()
{
diff --git a/src/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs b/src/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs
index 4a1226e1d..e40f9a0fa 100644
--- a/src/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs
+++ b/src/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
@@ -15,6 +16,17 @@ namespace NzbDrone.Core.Test.Datastore
[TestFixture]
public class DatabaseRelationshipFixture : DbTest
{
+ [SetUp]
+ public void Setup()
+ {
+ AssertionOptions.AssertEquivalencyUsing(options =>
+ {
+ options.Using(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation.ToUniversalTime(), TimeSpan.FromMilliseconds(20))).WhenTypeIs();
+ options.Using(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation.Value.ToUniversalTime(), TimeSpan.FromMilliseconds(20))).WhenTypeIs();
+ return options;
+ });
+ }
+
[Test]
public void one_to_one()
{
diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/070_delay_profileFixture.cs b/src/NzbDrone.Core.Test/Datastore/Migration/070_delay_profileFixture.cs
index bdc199f1f..90304067f 100644
--- a/src/NzbDrone.Core.Test/Datastore/Migration/070_delay_profileFixture.cs
+++ b/src/NzbDrone.Core.Test/Datastore/Migration/070_delay_profileFixture.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Datastore.Migration;
@@ -26,12 +26,12 @@ namespace NzbDrone.Core.Test.Datastore.Migration
{
GrabDelay = 2,
Name = "TwoHours",
- Cutoff = "{}",
+ Cutoff = 0,
Items = "[]"
});
});
- var allProfiles = db.Query("SELECT * FROM DelayProfiles");
+ var allProfiles = db.Query("SELECT * FROM \"DelayProfiles\"");
allProfiles.Should().HaveCount(3);
allProfiles.Should().OnlyContain(c => c.PreferredProtocol == 1);
@@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
});
});
- var tags = db.Query("SELECT * FROM Tags");
+ var tags = db.Query("SELECT * FROM \"Tags\"");
tags.Should().HaveCount(1);
tags.First().Label.Should().Be("delay-60");
@@ -83,17 +83,17 @@ namespace NzbDrone.Core.Test.Datastore.Migration
Status = 0,
Images = "[]",
Path = @"C:\Test\Series",
- Monitored = 1,
- SeasonFolder = 1,
- RunTime = 0,
+ Monitored = true,
+ SeasonFolder = true,
+ Runtime = 0,
SeriesType = 0,
- UseSceneNumbering = 0,
+ UseSceneNumbering = false,
Tags = "[1]"
});
});
- var tag = db.Query("SELECT Id, Label FROM Tags").Single();
- var series = db.Query("SELECT Tags FROM Series");
+ var tag = db.Query("SELECT \"Id\", \"Label\" FROM \"Tags\"").Single();
+ var series = db.Query("SELECT \"Tags\" FROM \"Series\"");
series.Should().HaveCount(1);
diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs b/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs
index 4aa14402f..5f5d8b1c6 100644
--- a/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs
+++ b/src/NzbDrone.Core.Test/Datastore/Migration/071_unknown_quality_in_profileFixture.cs
@@ -1,6 +1,8 @@
+using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
+using NzbDrone.Common.Serializer;
using NzbDrone.Core.Datastore.Migration;
using NzbDrone.Core.Test.Framework;
@@ -19,12 +21,19 @@ namespace NzbDrone.Core.Test.Datastore.Migration
Id = 0,
Name = "SDTV",
Cutoff = 1,
- Items = "[ { \"quality\": 1, \"allowed\": true } ]",
+ Items = new List