From 79d4e1a89ad5a8c0e36e418a3957790499b54758 Mon Sep 17 00:00:00 2001 From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com> Date: Mon, 18 Jul 2022 14:57:15 +0100 Subject: [PATCH] Add test for postgres to check datetime without timezone Fixed: Postgres timezone issues Co-authored-by: ta264 (cherry picked from commit d55864f86914199aa0c4ee37df1e42e6ad71ef4f) (cherry picked from commit c006b66aa470616ec30994d0b95e3bd307aa82bd) --- .../Datastore/DatabaseFixture.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs b/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs index d37789f5b..1a4dc1de8 100644 --- a/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/DatabaseFixture.cs @@ -27,6 +27,20 @@ public void vacuum() 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() {