persistent-mysql 2.6.0.1 → 2.6.0.2
raw patch · 3 files changed
+13/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Database/Persist/MySQL.hs +8/−4
- persistent-mysql.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+##2.6.0.2++Prevent spurious no-op migrations when `default=NULL` is specified - revised version [#672](https://github.com/yesodweb/persistent/pull/672) (which fixes bug [#671](https://github.com/yesodweb/persistent/issues/671) introduced by the earlier attempt [#641](https://github.com/yesodweb/persistent/pull/641))+ ## 2.6 Compatibility for backend-specific upsert functionality.
Database/Persist/MySQL.hs view
@@ -457,7 +457,7 @@ stmtIdClmn <- getter "SELECT COLUMN_NAME, \ \IS_NULLABLE, \ \DATA_TYPE, \- \IF(IS_NULLABLE='YES', COALESCE(COLUMN_DEFAULT, 'NULL'), COLUMN_DEFAULT) \+ \COLUMN_DEFAULT \ \FROM INFORMATION_SCHEMA.COLUMNS \ \WHERE TABLE_SCHEMA = ? \ \AND TABLE_NAME = ? \@@ -473,7 +473,7 @@ \CHARACTER_MAXIMUM_LENGTH, \ \NUMERIC_PRECISION, \ \NUMERIC_SCALE, \- \IF(IS_NULLABLE='YES', COALESCE(COLUMN_DEFAULT, 'NULL'), COLUMN_DEFAULT) \+ \COLUMN_DEFAULT \ \FROM INFORMATION_SCHEMA.COLUMNS \ \WHERE TABLE_SCHEMA = ? \ \AND TABLE_NAME = ? \@@ -691,10 +691,12 @@ modType | showSqlType type_ maxLen False `ciEquals` showSqlType type_' maxLen' False && isNull == isNull' = [] | otherwise = [(name, Change col)] -- Default value+ -- Avoid DEFAULT NULL, since it is always unnecessary, and is an error for text/blob fields modDef | def == def' = [] | otherwise = case def of Nothing -> [(name, NoDefault)]- Just s -> [(name, Default $ T.unpack s)]+ Just s -> if T.toUpper s == "NULL" then []+ else [(name, Default $ T.unpack s)] in ( refDrop ++ modType ++ modDef ++ refAdd , filter ((name /=) . cName) cols ) @@ -715,7 +717,9 @@ , if nu then "NULL" else "NOT NULL" , case def of Nothing -> ""- Just s -> " DEFAULT " ++ T.unpack s+ Just s -> -- Avoid DEFAULT NULL, since it is always unnecessary, and is an error for text/blob fields+ if T.toUpper s == "NULL" then ""+ else " DEFAULT " ++ T.unpack s , case ref of Nothing -> "" Just (s, _) -> " REFERENCES " ++ escapeDBName s
persistent-mysql.cabal view
@@ -1,5 +1,5 @@ name: persistent-mysql-version: 2.6.0.1+version: 2.6.0.2 license: MIT license-file: LICENSE author: Felipe Lessa <felipe.lessa@gmail.com>, Michael Snoyman