packages feed

persistent-postgresql 2.6.2 → 2.6.2.1

raw patch · 3 files changed

+25/−17 lines, 3 filesnew-uploader

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.6.2.1++* Fix bug where, if a custom column width was set, the field would be migrated every time [#742](https://github.com/yesodweb/persistent/pull/742)+ ## 2.6.2  * Expose new functions: `withPostgresqlPoolWithVersion`, `withPostgresqlConnWithVersion` and `createPostgresqlPoolModifiedWithVersion`.
Database/Persist/Postgresql.hs view
@@ -230,7 +230,7 @@                          else Nothing  --- | Generate a 'Connection' from a 'PG.Connection'+-- | Generate a 'SqlBackend' from a 'PG.Connection' openSimpleConn :: (IsSqlBackend backend) => LogFunc -> PG.Connection -> IO backend openSimpleConn logFunc conn = do     smap <- newIORef $ Map.empty@@ -644,6 +644,7 @@                           ,",column_default "                           ,",numeric_precision "                           ,",numeric_scale "+                          ,",character_maximum_length "                           ,"FROM information_schema.columns "                           ,"WHERE table_catalog=current_database() "                           ,"AND table_schema=current_schema() "@@ -742,24 +743,27 @@ getColumn :: (Text -> IO Statement)           -> DBName -> [PersistValue]           -> IO (Either Text Column)-getColumn getter tname [PersistText x, PersistText y, PersistText z, d, npre, nscl] =+getColumn getter tname [PersistText x, PersistText y, PersistText z, d, npre, nscl, maxlen] =     case d' of         Left s -> return $ Left s         Right d'' ->-            case getType z of-                Left s -> return $ Left s-                Right t -> do-                    let cname = DBName x-                    ref <- getRef cname-                    return $ Right Column-                        { cName = cname-                        , cNull = y == "YES"-                        , cSqlType = t-                        , cDefault = fmap stripSuffixes d''-                        , cDefaultConstraintName = Nothing-                        , cMaxLen = Nothing-                        , cReference = ref-                        }+            let typeStr = case maxlen of+                            PersistInt64 n -> T.concat [z, "(", T.pack (show n), ")"]+                            _              -> z+             in case getType typeStr of+                  Left s -> return $ Left s+                  Right t -> do+                      let cname = DBName x+                      ref <- getRef cname+                      return $ Right Column+                          { cName = cname+                          , cNull = y == "YES"+                          , cSqlType = t+                          , cDefault = fmap stripSuffixes d''+                          , cDefaultConstraintName = Nothing+                          , cMaxLen = Nothing+                          , cReference = ref+                          }   where     stripSuffixes t =         loop'
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name:            persistent-postgresql-version:         2.6.2+version:         2.6.2.1 license:         MIT license-file:    LICENSE author:          Felipe Lessa, Michael Snoyman <michael@snoyman.com>