persistent-mysql
Backend for the persistent library using MySQL database server.
http://www.yesodweb.com/book/persistent
| Version on this page: | 2.13.1.4 |
| LTS Haskell 24.16: | 2.13.1.5 |
| Stackage Nightly 2025-07-14: | 2.13.1.5 |
| Latest on Hackage: | 2.13.1.5 |
persistent-mysql-2.13.1.4@sha256:1df07e41f40d55a9842369740bcff0351d83ab0c4ccfe32d5bd0f4ac1fc68a1c,2759Module documentation for 2.13.1.4
- Database
- Database.Persist
This package contains a backend for persistent using the
MySQL database server. Internally it uses the mysql-simple
and mysql packages in order to access the database.
This package supports only MySQL 5.1 and above. However, it has been tested only on MySQL 5.5. Only the InnoDB storage engine is officially supported.
Known problems:
This package does not support statements inside other statements.
Changes
Changelog for persistent-mysql
2.13.1.4
- #1459
- Make use of
CautiousMigrationtype alias for clarity.
- Make use of
2.13.1.3
- #1372
- Fix migrations which add a new column in
persistent-mysql(#1373) - Include MigrationTest in
persistent-mysqltests
- Fix migrations which add a new column in
2.13.1.2
2.13.1.1
- #1360
- Fix anomalies in migration of integer columns in MySQL 8
2.13.1.0
- #1341
- Add
SqlBackendHooksto allow for instrumentation of queries.
- Add
- #1327
- Update backend to support new
StatementCacheinterface
- Update backend to support new
2.13.0.4
- No longer errors on
jsoncolumns. #1333
2.13.0.3
- Bugfix: Omit
REFERENCESinCREATe TABLEstatements. These are ignored by MySQL, but are a syntax error for MariaDB. #1355, a continuation of #1283
2.13.0.2
- Bugfix: prevent fetching constraint info from other databases during migrations #1301
2.13.0.1
- #1275
- Fix
SafeToRemove
- Fix
2.13.0.0
- #1225
- Support
persistent-2.13changes for SqlBackend being made internal. - Remove the deprecated
SomeFieldtype and pattern.
- Support
2.12.1.0
- Expose
openMySQLConnfor explicit reference to opened connection. #1248- Makes it convenient to use with
mysql-simple.
- Makes it convenient to use with
2.12.0.0
- Decomposed
HaskellNameintoConstraintNameHS,EntityNameHS,FieldNameHS. DecomposedDBNameintoConstraintNameDB,EntityNameDB,FieldNameDBrespectively. #1174
2.10.3.1
- Fix foreign key migrations [#1167] https://github.com/yesodweb/persistent/pull/1167
- Fix a bug where a foreign key of a field to its table was ignored.
2.10.3
- Compatibility with latest persistent
2.10.2.3
- Fix issue with multiple foreign keys on single column. #1025
2.10.2.2
- Compatibility with latest persistent-template for test suite #1002
2.10.2.1
- Changed persistent-mysql to use ‘utf8mb4’ instead of ‘utf8’ in migrations #980 @charukiewicz
2.10.2
- Added support for GHC 8.8 #977
2.10.1
- Added
constraint=attribute to allow users to specify foreign reference constraint names.
2.10.0
- Remove deprecated
SomeFieldtype and pattern synonym. UseHandleUpdateCollisiontype instead and thecopyFieldfunction instead ofSomeFieldconstructor/pattern. #894
2.9.0
- Added support for SQL isolation levels to via SqlBackend. [#812]
- Fix 832:
repsertManynow matchesmapM_ (uncurry repsert)and is atomic.
2.8.1
- Implemented
connPutManySqlto utilize batchedputMany. #770
2.8.0
- Switch from
MonadBaseControltoMonadUnliftIO - Fix duplicate migrations when using
mediumtext,longtext,mediumblob,longblob, anddoubles using a custom precision. #754
– This can be released as a minor change on the next update. Currently persistent-mysql can’t be released because 2.6.2.2 depends on persistent-2.7.2 being released.
- The
SomeFieldtype was renamed toHandleUpdateCollisionand deprecated. Please migrate to usingHandleUpdateCollision. - The
SomeFieldconstructor was deprecated, and a temporary pattern synonym introduced. Please migrate to usingcopyField.
2.6.2.2 [UNRELEASED ON HACKAGE]
– This version depends on persistent 2.7.2, which introduced breaking changes and is deprecated on hackage.
- Fix ambiguous type errors introduced by
persistent-2.7.2#723
2.6.2.1
- Fix haddock documentation #725
2.6.2
- Extend the
SomeFieldtype to allowinsertManyOnDuplicateKeyUpdateto conditionally copy values. - Depend on
mysql-simple >= 0.4.3to fix encoding and decoding of date/time values with fractional seconds (when a column is specified using something likesqltype=TIME(6)). See also #705 - Fix behavior of
insertManyOnDuplicateKeyUpdateto ignore duplicate key exceptions when no updates specified.
2.6.1
- Add functions
insertOnDuplicateKeyUpdate,insertManyOnDuplicateKeyUpdatetoDatabase.Persist.MySQLmodule.
2.6.0.2
Prevent spurious no-op migrations when default=NULL is specified - revised version #672 (which fixes bug #671 introduced by the earlier attempt #641)
2.6
Compatibility for backend-specific upsert functionality. A lucky contributor could add upsert to the MySQL backend now, i.e.: INSERT … ON DUPICATE …
2.5
- changes for read/write typeclass split
2.3.0.1
Support usign default= for changing the id field type
2.3
- Distinguish between binary and non-binary strings in MySQL #451
- Previously all string columns (VARCHAR, TEXT, etc.) were being returned from Persistent as
PersistByteStrings (i.e. as binary data). Persistent now checks character set information to determine if the value should be returned asPersistTextorPersistByteString. - This is a breaking change if your code is relying on a
PersistByteStringbeing returned for string-like MySQL values; persistent-mysql itself had several runtime errors that needed to be fixed because of this patch. High-level code dealing purely withPersistEntitiesshould be unaffected.
- Previously all string columns (VARCHAR, TEXT, etc.) were being returned from Persistent as
2.2
- Update to persistent 2.2
2.1.3
- Added a
Showinstance forMySQLConf.
2.1.2.1
Documentation typo fix
2.1.2
Provide a FromJSON instance for MySQLConf.