persistent-postgresql 2.6.2.1 → 2.6.2.2
raw patch · 3 files changed
+17/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Database/Persist/Postgresql.hs +12/−5
- persistent-postgresql.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.6.2.2++* Because `text` and `varchar` are synonyms in Postgresql, don't attempt to migrate between them. [#762](https://github.com/yesodweb/persistent/pull/762)+ ## 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)
Database/Persist/Postgresql.hs view
@@ -619,7 +619,7 @@ type SafeToRemove = Bool -data AlterColumn = Type SqlType Text+data AlterColumn = ChangeType SqlType Text | IsNull | NotNull | Add' Column | Drop SafeToRemove | Default Text | NoDefault | Update' Text | AddReference DBName [DBName] [Text] | DropReference DBName@@ -640,7 +640,7 @@ let sqlv=T.concat ["SELECT " ,"column_name " ,",is_nullable "- ,",udt_name "+ ,",COALESCE(domain_name, udt_name)" -- See DOMAINS below ,",column_default " ,",numeric_precision " ,",numeric_scale "@@ -651,6 +651,12 @@ ,"AND table_name=? " ,"AND column_name <> ?"] +-- DOMAINS Postgres supports the concept of domains, which are data types with optional constraints.+-- An app might make an "email" domain over the varchar type, with a CHECK that the emails are valid+-- In this case the generated SQL should use the domain name: ALTER TABLE users ALTER COLUMN foo TYPE email+-- This code exists to use the domain name (email), instead of the underlying type (varchar).+-- This is tested in EquivalentTypeTest.hs+ stmt <- getter sqlv let vals = [ PersistText $ unDBName $ entityDB def@@ -801,6 +807,7 @@ getType "int4" = Right SqlInt32 getType "int8" = Right SqlInt64 getType "varchar" = Right SqlString+ getType "text" = Right SqlString getType "date" = Right SqlDay getType "bool" = Right SqlBool getType "timestamptz" = Right SqlDayTime@@ -851,12 +858,12 @@ -- need to make sure that TIMESTAMP WITHOUT TIME ZONE is -- treated as UTC. | sqltype == SqlDayTime && sqltype' == SqlOther "timestamp" =- [(name, Type sqltype $ T.concat+ [(name, ChangeType sqltype $ T.concat [ " USING " , escape name , " AT TIME ZONE 'UTC'" ])]- | otherwise = [(name, Type sqltype "")]+ | otherwise = [(name, ChangeType sqltype "")] modDef = if def == def' then []@@ -935,7 +942,7 @@ ] showAlter :: DBName -> AlterColumn' -> Text-showAlter table (n, Type t extra) =+showAlter table (n, ChangeType t extra) = T.concat [ "ALTER TABLE " , escape table
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 2.6.2.1+version: 2.6.2.2 license: MIT license-file: LICENSE author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>