From 971937387f2e7fdcd6d9d2c482d6aef032ed9c94 Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Sat, 14 Mar 2020 21:59:09 -0400 Subject: [PATCH 1/5] Stackage version upgrade and update Hasql calls to latest version --- app/Main.hs | 2 +- src/PostgresWebsockets/Database.hs | 4 +-- stack.yaml | 2 +- stack.yaml.lock | 40 ++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 stack.yaml.lock diff --git a/app/Main.hs b/app/Main.hs index cad7f04..ba52f04 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -32,7 +32,7 @@ isServerVersionSupported = do where pgVersion = H.Statement "SELECT current_setting('server_version_num')::integer" - HE.unit (HD.singleRow $ HD.column HD.int4) False + HE.noParams (HD.singleRow $ HD.column $ HD.nonNullable $ HD.int4) False main :: IO () main = do diff --git a/src/PostgresWebsockets/Database.hs b/src/PostgresWebsockets/Database.hs index a732a0e..c9d6fea 100644 --- a/src/PostgresWebsockets/Database.hs +++ b/src/PostgresWebsockets/Database.hs @@ -49,8 +49,8 @@ notifyPool pool channel mesg = where mapError :: Either UsageError () -> Either Error () mapError = mapLeft (NotifyError . show) - callStatement = HST.Statement ("SELECT pg_notify" <> "($1, $2)") encoder HD.unit False - encoder = contramap fst (HE.param HE.text) <> contramap snd (HE.param HE.text) + callStatement = HST.Statement ("SELECT pg_notify" <> "($1, $2)") encoder HD.noResult False + encoder = contramap fst (HE.param $ HE.nonNullable $ HE.text) <> contramap snd (HE.param $ HE.nonNullable $ HE.text) -- | Given a Hasql Connection, a channel and a message sends a notify command to the database notify :: Connection -> PgIdentifier -> ByteString -> IO (Either Error ()) diff --git a/stack.yaml b/stack.yaml index b77eda9..bee0f53 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-13.14 +resolver: lts-14.27 extra-deps: - envparse-0.4.1@sha256:989902e6368532548f61de1fa245ad2b39176cddd8743b20071af519a709ce30 - stm-containers-1.1.0.2@sha256:8976df591e61f378ef29dc0443dbe2d5d34818c898093af3ca138ea1d013b5eb diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..5f69f60 --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,40 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + hackage: envparse-0.4.1@sha256:989902e6368532548f61de1fa245ad2b39176cddd8743b20071af519a709ce30,2842 + pantry-tree: + size: 1180 + sha256: 35044d67979fe2a5cff05cf8736a06a265592433cdd03e13a72908ceed892612 + original: + hackage: envparse-0.4.1@sha256:989902e6368532548f61de1fa245ad2b39176cddd8743b20071af519a709ce30 +- completed: + hackage: stm-containers-1.1.0.2@sha256:8976df591e61f378ef29dc0443dbe2d5d34818c898093af3ca138ea1d013b5eb,3210 + pantry-tree: + size: 697 + sha256: 61e041a97aa230e874a50cdea4ded5f264fbb6337811cf4adf4cadd51176a084 + original: + hackage: stm-containers-1.1.0.2@sha256:8976df591e61f378ef29dc0443dbe2d5d34818c898093af3ca138ea1d013b5eb +- completed: + hackage: stm-hamt-1.2.0.2@sha256:18126db7bf2d9c967a6020c677b3005dd957a4c39d69aeaea3c29c90de8f6124,3972 + pantry-tree: + size: 1009 + sha256: ef426797655d6b4b9238b1200c4129d44e91f996f26b92a035b1333b8b8a6f62 + original: + hackage: stm-hamt-1.2.0.2@sha256:18126db7bf2d9c967a6020c677b3005dd957a4c39d69aeaea3c29c90de8f6124 +- completed: + hackage: primitive-extras-0.7.1@sha256:23905c57089418b1a2d324cfee3e81bbd5a344a0fa56a827867b2dce275fdb5e,2945 + pantry-tree: + size: 1181 + sha256: f788dae21ca4f0d0377d97a5ba7fd008d4b0af8991a745f94c29f2caa11dc6bd + original: + hackage: primitive-extras-0.7.1@sha256:23905c57089418b1a2d324cfee3e81bbd5a344a0fa56a827867b2dce275fdb5e +snapshots: +- completed: + size: 524996 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml + sha256: 7ea31a280c56bf36ff591a7397cc384d0dff622e7f9e4225b47d8980f019a0f0 + original: lts-14.27 From bf4f70d8d70797444c73306d8f1c852cc6b6924f Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Sat, 14 Mar 2020 22:28:50 -0400 Subject: [PATCH 2/5] User trust authentication for test database --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c674ff5..f293911 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,6 +35,7 @@ jobs: environment: POSTGRES_DB: postgres_ws_test POSTGRES_USER: root + POSTGRES_HOST_AUTH_METHOD: trust steps: - checkout - restore_cache: From 4e7c81eeaed5d2cc415969451ed5e883b5a3a2df Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Sat, 14 Mar 2020 22:36:19 -0400 Subject: [PATCH 3/5] Configure circle to use new stackage image --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f293911..fec9733 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ version: 2 jobs: publish: docker: - - image: fpco/stack-build-small:lts + - image: fpco/stack-build-small:lts-14 steps: - attach_workspace: at: ws @@ -30,7 +30,7 @@ jobs: build-test: docker: - - image: fpco/stack-build:lts-13.14 + - image: fpco/stack-build:lts-14.27 - image: postgres:11-alpine environment: POSTGRES_DB: postgres_ws_test @@ -47,7 +47,7 @@ jobs: command: stack setup - run: name: Install Cabal and hlint - command: stack install --system-ghc --resolver=lts-13.14 Cabal hlint + command: stack install --system-ghc --resolver=lts-14.27 Cabal hlint - save_cache: name: Cache Dependencies key: postgres-websockets-v2-{{ checksum "stack.yaml" }} From c667f289e7da7e3b5d85f9df9beaed519c3840e8 Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Sun, 15 Mar 2020 00:00:20 -0400 Subject: [PATCH 4/5] Use hlint from OS --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fec9733..070e4ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,8 +46,8 @@ jobs: name: Resolve and update dependencies command: stack setup - run: - name: Install Cabal and hlint - command: stack install --system-ghc --resolver=lts-14.27 Cabal hlint + name: Install hlint + command: apt-get update && apt-get -qq -y install hlint - save_cache: name: Cache Dependencies key: postgres-websockets-v2-{{ checksum "stack.yaml" }} From e2002a9460199a131bda5bc3ff86a58bb086575f Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Mon, 16 Mar 2020 19:40:56 -0400 Subject: [PATCH 5/5] Update author email and bump minor version number --- postgres-websockets.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postgres-websockets.cabal b/postgres-websockets.cabal index a19ae87..1153a39 100644 --- a/postgres-websockets.cabal +++ b/postgres-websockets.cabal @@ -1,12 +1,12 @@ name: postgres-websockets -version: 0.5.0.1 +version: 0.5.0.2 synopsis: Middleware to map LISTEN/NOTIFY messages to Websockets description: Please see README.md homepage: https://github.com/diogob/postgres-websockets#readme license: BSD3 license-file: LICENSE author: Diogo Biazus -maintainer: diogo@biazus.me +maintainer: diogo@biazus.ca copyright: 2016 Diogo Biazus category: Web build-type: Simple