From 9e378b675fe7fb88d5ddb3af068d82eb441f343c Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 10 Mar 2023 14:40:27 +0000 Subject: [PATCH] Switch to decimal from money. --- src/Data/Money/Rel8.hs | 4 +++- test/Rel8Spec.hs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Data/Money/Rel8.hs b/src/Data/Money/Rel8.hs index e018b3d..4767d99 100644 --- a/src/Data/Money/Rel8.hs +++ b/src/Data/Money/Rel8.hs @@ -7,11 +7,13 @@ import Data.Money.Internal import Data.Scientific import Rel8 +import Debug.Trace + instance DBType (Money curr) where typeInformation = let sci = typeInformation @Scientific in TypeInformation { encode = encode sci . realToFrac . getAmount , decode = fmap (Money . realToFrac) (decode sci) - , typeName = "money" + , typeName = "decimal" } diff --git a/test/Rel8Spec.hs b/test/Rel8Spec.hs index 46e41fb..fa60713 100644 --- a/test/Rel8Spec.hs +++ b/test/Rel8Spec.hs @@ -48,7 +48,7 @@ createConnection = throwLeft =<< Hasql.acquire dbsets createTable :: Connection -> IO () createTable conn = throwLeft =<< Hasql.run sql conn - where sql = Hasql.sql "CREATE TABLE bucks (amount money not null);" + where sql = Hasql.sql "CREATE TABLE bucks (amount decimal not null);" dropTable :: Connection -> IO () dropTable conn = throwLeft =<< Hasql.run sql conn