mirror of
https://github.com/typeable/bucks.git
synced 2024-08-17 02:50:36 +03:00
Switch to decimal from money.
This commit is contained in:
parent
cac01c80e2
commit
9e378b675f
@ -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"
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user