diff options
author | stuebinm | 2022-06-16 01:06:04 +0200 |
---|---|---|
committer | stuebinm | 2022-06-16 01:06:04 +0200 |
commit | 8feb2556eda0604b6710309bf7ffddb72c22fc4a (patch) | |
tree | bc3dfc2256bfd7349d415caae8768e35ad4981d1 /lib/PersistOrphans.hs | |
parent | 9e89c93b3b84b5c82c186cff62c33218a0a4d298 (diff) |
foreign keys are a thing
(and they can be useful, too!)
Also, documentation & deleting imports / extensions that aren't used.
Diffstat (limited to '')
-rw-r--r-- | lib/PersistOrphans.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PersistOrphans.hs b/lib/PersistOrphans.hs index 68e9738..1f521cc 100644 --- a/lib/PersistOrphans.hs +++ b/lib/PersistOrphans.hs @@ -1,9 +1,9 @@ --- | This module contains instances for the Data.UUID UUID type --- to be mapped to postgresql's custom builtin uuid type. +-- | Instances for the Data.UUID UUID type to be mapped to postgresql's +-- custom builtin uuid type. -- -- Unfortunately, this breaks compatability with other SQL databases -- (though uuids aren't really supported by most anyways) -module PersistOrphans where +module PersistOrphans () where import Data.Either.Combinators (maybeToRight) @@ -25,8 +25,10 @@ instance PersistField UUID where maybeToRight "not a uuid (cannot decode)" $ UUID.fromASCIIBytes buf fromPersistValue v = Left $ "not a uuid (wrong type in database): " <> T.pack (show v) -- postgres is type-safe, so this should /hopefully/ never happen + instance PersistFieldSql UUID where sqlType = const $ SqlOther "uuid" + instance PathPiece UUID where fromPathPiece = UUID.fromText toPathPiece = UUID.toText |