persistent-postgresql 2.0.1 → 2.0.3
raw patch · 2 files changed
+13/−8 lines, 2 filesdep ~persistent
Dependency ranges changed: persistent
Files
Database/Persist/Postgresql.hs view
@@ -159,7 +159,7 @@ ] in case entityPrimary ent of Just _pdef -> ISRManyKeys sql vals- Nothing -> ISRSingle (sql <> " RETURNING " <> escape (entityID ent))+ Nothing -> ISRSingle (sql <> " RETURNING " <> escape (sqlIdName ent)) execute' :: PG.Connection -> PG.Query -> [PersistValue] -> IO Int64 execute' conn query vals = PG.execute conn query (map P vals)@@ -301,7 +301,12 @@ , (k PS.uuid, convertPV (PersistDbSpecific . unUnknown)) , (k PS.json, convertPV (PersistByteString . unUnknown)) , (k PS.unknown, convertPV (PersistByteString . unUnknown))+ -- add Inet and Cidr types+ , (k PS.inet, convertPV (PersistDbSpecific . unUnknown))+ , (k PS.cidr, convertPV (PersistDbSpecific . unUnknown))+ + -- array types: same order as above , (1000, listOf PersistBool) , (1001, listOf (PersistByteString . unBinary))@@ -392,8 +397,8 @@ if not exists then do let idtxt = case entityPrimary val of- Just pdef -> T.concat [" PRIMARY KEY (", T.intercalate "," $ map (escape . fieldDB) $ primaryFields pdef, ")"]- Nothing -> T.concat [escape $ entityID val+ Just pdef -> T.concat [" PRIMARY KEY (", T.intercalate "," $ map (escape . fieldDB) $ compositeFields pdef, ")"]+ Nothing -> T.concat [escape $ sqlIdName val , " SERIAL PRIMARY KEY UNIQUE"] let addTable = AddTable $ T.concat -- Lower case e: see Database.Persist.Sql.Migration@@ -454,7 +459,7 @@ stmt <- getter sqlv let vals = [ PersistText $ unDBName $ entityDB def- , PersistText $ unDBName $ entityID def+ , PersistText $ unDBName $ sqlIdName def ] cs <- with (stmtQuery stmt vals) ($$ helper) let sqlc = T.concat ["SELECT "@@ -627,7 +632,7 @@ refDrop (Just (_, cname)) = [(name, DropReference cname)] refAdd Nothing = [] refAdd (Just (tname, a)) = case find ((==tname) . entityDB) defs of- Just refdef -> [(tname, AddReference a [name] [entityID refdef])]+ Just refdef -> [(tname, AddReference a [name] [sqlIdName refdef])] Nothing -> error $ "could not find the entityDef for reftable[" ++ show tname ++ "]" modRef = if fmap snd ref == fmap snd ref'@@ -672,7 +677,7 @@ id_ = fromMaybe (error $ "Could not find ID of entity " ++ show reftable) $ do entDef <- find ((== reftable) . entityDB) allDefs- return (entityID entDef)+ return (sqlIdName entDef) showColumn :: Column -> Text
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 2.0.1+version: 2.0.3 license: MIT license-file: LICENSE author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>@@ -18,7 +18,7 @@ , transformers >= 0.2.1 , postgresql-simple >= 0.3.10 && < 0.5 , postgresql-libpq >= 0.6.1 && < 0.10- , persistent >= 2.0.1 && < 2.1+ , persistent >= 2.0.3 && < 2.1 , containers >= 0.2 , bytestring >= 0.9 , text >= 0.7