@@ -18,6 +18,7 @@ import Data.Binary (Binary)
1818import Data.Coerce (coerce)
1919import Data.Data
2020import Data.Hashable (Hashable)
21+import Data.Int (Int64)
2122import Data.OpenApi
2223import Data.String
2324import Data.Text as T
@@ -44,6 +45,9 @@ import Flat as F
4445#ifdef USE_STORE
4546import qualified Data.Store
4647#endif
48+#ifdef USE_REL8
49+import Rel8 (DBType(..))
50+#endif
4751
4852newtype Id t = Id { unId :: UUID }
4953 deriving stock Data
@@ -53,6 +57,9 @@ newtype Id t = Id { unId :: UUID }
5357#ifdef USE_POSTGRES
5458 , PG.ToField, PG.FromField
5559#endif
60+#ifdef USE_REL8
61+ , DBType
62+#endif
5663#endif
5764 , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
5865 , ToParamSchema, FromHttpApiData, ToHttpApiData )
@@ -133,7 +140,7 @@ type family Ambiguous (a :: k) :: j where
133140 Ambiguous x = x
134141
135142----------------- IntId
136−newtype IntId t = IntId { unIntId :: Integer }
143+newtype IntId t = IntId { unIntId :: Int64 }
137144 deriving stock Data
138145 deriving newtype
139146 ( Eq, Ord, Binary
@@ -150,6 +157,9 @@ newtype IntId t = IntId { unIntId :: Integer }
150157#ifdef USE_STORE
151158 , Data.Store.Store
152159#endif
160+#ifdef USE_REL8
161+ , DBType
162+#endif
153163#endif
154164 , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
155165 , ToParamSchema, FromHttpApiData, ToHttpApiData, PathPiece, Arbitrary
@@ -160,7 +170,7 @@ type role IntId nominal
160170makePrisms ''IntId
161171
162172mkIntId :: forall s. Integer -> IntId s
163−mkIntId = coerce
173+mkIntId = fromInteger
164174{-# INLINE mkIntId #-}
165175
166176instance KnownSymbol s => Show (IntId s) where
@@ -199,6 +209,9 @@ newtype Name t = Name { unName :: Text }
199209#ifdef USE_STORE
200210 , Data.Store.Store
201211#endif
212+#ifdef USE_REL8
213+ , DBType
214+#endif
202215#endif
203216 , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
204217 , ToParamSchema, FromHttpApiData, ToHttpApiData, PathPiece