persistent-postgresql 2.13.0.1 → 2.13.0.2
raw patch · 3 files changed
+29/−6 lines, 3 files
Files
- ChangeLog.md +8/−0
- Database/Persist/Postgresql.hs +20/−5
- persistent-postgresql.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,13 @@ # Changelog for persistent-postgresql +## 2.13.0.2++* Actually release the SafeTORemove fix++## 2.13.0.1++* [#1275](https://github.com/yesodweb/persistent/pull/1275)+ * Fix `SafeToRemove` ## 2.13.0.0
Database/Persist/Postgresql.hs view
@@ -402,7 +402,7 @@ sql = T.concat [ "INSERT INTO " , escapeE $ getEntityDBName ent- , if null (getEntityFieldsDatabase ent)+ , if null (getEntityFields ent) then " DEFAULT VALUES" else T.concat [ "("@@ -864,7 +864,11 @@ Just _ -> cols _ ->- filter (\c -> Just (cName c) /= fmap fieldDB (getEntityIdField entity) ) cols+ filter keepField cols+ where+ keepField c =+ Just (cName c) /= fmap fieldDB (getEntityIdField entity)+ && not (safeToRemove entity (cName c)) name = getEntityDBName entity@@ -1009,7 +1013,14 @@ safeToRemove def (FieldNameDB colName) = any (elem FieldAttrSafeToRemove . fieldAttrs) $ filter ((== FieldNameDB colName) . fieldDB)- $ NEL.toList $ keyAndEntityFields def+ $ allEntityFields+ where+ allEntityFields =+ getEntityFieldsDatabase def <> case getEntityId def of+ EntityIdField fdef ->+ [fdef]+ _ ->+ [] getAlters :: [EntityDef] -> EntityDef@@ -1301,8 +1312,12 @@ case def of Nothing -> [NoDefault col] Just s -> [Default col s]+ dropSafe =+ if safeToRemove edef name+ then error "wtf" [Drop col True]+ else [] in- ( modRef ++ modDef ++ modNull ++ modType+ ( modRef ++ modDef ++ modNull ++ modType ++ dropSafe , filter (\c -> cName c /= name) cols ) @@ -1742,7 +1757,7 @@ putManySql :: EntityDef -> Int -> Text putManySql ent n = putManySql' conflictColumns fields ent n where- fields = getEntityFieldsDatabase ent+ fields = getEntityFields ent conflictColumns = concatMap (map (escapeF . snd) . NEL.toList . uniqueFields) (getEntityUniques ent) repsertManySql :: EntityDef -> Int -> Text
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 2.13.0.1+version: 2.13.0.2 license: MIT license-file: LICENSE author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>