Skip to content
Browse files

new SqlType constructor SqlDayTimeZoned for the PostgreSQL column "ti…

…mestamptz"
  • Loading branch information...
1 parent 7c35b65 commit 3947398fa799ccf7a4a8e4e83dee1c9e3f4afc72 @rekado rekado committed
Showing with 4 additions and 2 deletions.
  1. +2 −1 persistent-postgresql/Database/Persist/Postgresql.hs
  2. +2 −1 persistent/Database/Persist/Store.hs
View
3 persistent-postgresql/Database/Persist/Postgresql.hs
@@ -414,7 +414,7 @@ getColumn getter tname [PersistText x, PersistText y, PersistText z, d] =
getType "date" = Right $ SqlDay
getType "bool" = Right $ SqlBool
getType "timestamp" = Right $ SqlDayTime
- getType "timestamptz" = Right $ SqlDayTime
+ getType "timestamptz" = Right $ SqlDayTimeZoned
getType "float4" = Right $ SqlReal
getType "float8" = Right $ SqlReal
getType "bytea" = Right $ SqlBlob
@@ -477,6 +477,7 @@ showSqlType SqlReal = "DOUBLE PRECISION"
showSqlType SqlDay = "DATE"
showSqlType SqlTime = "TIME"
showSqlType SqlDayTime = "TIMESTAMP"
+showSqlType SqlDayTimeZoned = "TIMESTAMP WITH TIME ZONE"
showSqlType SqlBlob = "BYTEA"
showSqlType SqlBool = "BOOLEAN"
View
3 persistent/Database/Persist/Store.hs
@@ -212,6 +212,7 @@ data SqlType = SqlString
| SqlDay
| SqlTime
| SqlDayTime
+ | SqlDayTimeZoned
| SqlBlob
deriving (Show, Read, Eq, Typeable, Ord)
@@ -395,7 +396,7 @@ instance PersistField ZonedTime where
(z, _):_ -> Right z
_ -> Left $ "Expected ZonedTime, received " ++ show x
fromPersistValue x = Left $ "Expected ZonedTime, received: " ++ show x
- sqlType _ = SqlDayTime
+ sqlType _ = SqlDayTimeZoned
instance PersistField a => PersistField (Maybe a) where
toPersistValue Nothing = PersistNull

0 comments on commit 3947398

Please sign in to comment.
Something went wrong with that request. Please try again.