Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
6b7a6b8
Copied persistent-mysql to persistent-mysql-haskell.
naushadh Mar 17, 2017
9f4f406
Ported persistent-mysql-haskell to use mysql-haskell.
naushadh Mar 31, 2017
849ce57
Removed TODO that was accidentally committed.
naushadh Apr 2, 2017
1e160c1
Updated bug-reports link to fork.
naushadh Apr 2, 2017
82095fc
Updated git info in cabal.
naushadh Apr 2, 2017
33e8c47
Updated documentation.
naushadh Apr 2, 2017
143b073
Added README and example.
naushadh Apr 2, 2017
14107b2
Bump version for new docs.
naushadh Apr 3, 2017
c899332
Added ability to set port and character-set.
naushadh Apr 3, 2017
283aa38
Updated README.
naushadh Apr 3, 2017
6c481d6
Merge branch 'master' into persistent-mysql-haskell
naushadh Apr 10, 2017
7726649
Merge branch 'master' into persistent-mysql-haskell
naushadh Apr 14, 2017
6217f2a
Added support for TLS.
naushadh Apr 14, 2017
5636de7
Updated README to add guide for secure connection.
naushadh Apr 14, 2017
b6b98e0
Merge branch 'master' into persistent-mysql-haskell
naushadh Apr 19, 2017
9ca2aa2
Clean compile in pedantic mode.
naushadh Apr 19, 2017
c421dbf
Travis fixes.
naushadh Apr 20, 2017
c29a1ce
Added mysql-haskell extra deps, removed lts2.
naushadh May 22, 2017
e89ad5d
ConnectInfo instance only for sub mysql-haskell-0.8.1.
naushadh Aug 7, 2017
c108da6
Moved import statement into CPP flag fence to compile in pedantic mode.
naushadh Aug 7, 2017
f438d85
Bumped up version.
naushadh Aug 7, 2017
9374d02
Merge branch 'master' into persistent-mysql-haskell-devel
naushadh Aug 7, 2017
33bd9e0
Port `#672` from `mysql-haskell`.
naushadh Aug 7, 2017
4b63ba9
Port `#674` from `mysql-haskell`.
naushadh Aug 7, 2017
c26abc0
Removed field doc that is never displayed and makes haddoc unhappy.
naushadh Aug 14, 2017
a6e71d6
Merged master into `persistent-mysql-haskell-devel`.
naushadh Oct 8, 2017
d373059
Port from #693 `mysql-haskell`.
naushadh Oct 8, 2017
324daed
Port #702 from `mysql-haskell`.
naushadh Oct 8, 2017
4272c44
Implemented result streaming to replace loading all results into memory.
naushadh Oct 9, 2017
8016db7
Bump TLS bounds.
naushadh Oct 12, 2017
4e4e7a6
bump version in cabal file.
naushadh Oct 13, 2017
bd789b0
Fix haddock issue.
naushadh Oct 17, 2017
a4beb78
Merge from persistent-mysql-haskell
naushadh Oct 28, 2017
8c93860
Fixed conduit usage to properly stream results.
naushadh Oct 28, 2017
b507f87
Fixed test failures by `skipToEof` on release.
naushadh Oct 28, 2017
32dce73
Update changelog with streaming enhancement.
naushadh Oct 28, 2017
13d32d9
Merge branch 'master' into persistent-mysql-haskell-devel
naushadh Oct 28, 2017
68c8b7a
Merge branch 'master' into persistent-mysql-haskell
naushadh Jan 3, 2018
5e08120
Updated test .cabal for mysql_haskell compatibility.
naushadh Jan 4, 2018
254a67b
Port #752 from persistent-mysql.
naushadh Jan 4, 2018
82b723a
Travis fixes.
naushadh Jan 4, 2018
eb573fe
Merged 'master' into 'persistent-mysql-haskell-devel'.
naushadh Feb 4, 2018
6ed2731
Merge branch 'master' into persistent-mysql-haskell-devel
naushadh Feb 4, 2018
f9bf5c1
Ported several upstream changes. See changelog.
naushadh Feb 4, 2018
6a64a76
Dropped extra-deps meant for `mysql_haskell` since we no longer have …
naushadh Feb 4, 2018
9fa2c77
[#2] Improve yesod scaffold compatibility.
naushadh Mar 11, 2018
3cda7d1
Added inline docs for new APIs.
naushadh Mar 11, 2018
e03649f
[#2] Updated README with latest diff from @alexkazik.
naushadh Jul 4, 2018
28a4e48
Merge pull request #6 from naushadh/fix-2
naushadh Jul 4, 2018
8a83088
Merge branch 'master' into persistent-mysql-haskell-devel
naushadh Jul 4, 2018
2c6ea59
Port #812 from `persistent-mysql`: Add support for SQL isolation levels.
naushadh Jul 4, 2018
6db6555
Fix boolean conversion bug (defaulting to False for many column types
jbransen Aug 21, 2018
1678524
Get rid of unused decodeBool
jbransen Aug 21, 2018
75996f6
Add pull request to ChangeLog
jbransen Aug 22, 2018
f3f3f23
Merge pull request #7 from chordify/persistent-mysql-haskell
naushadh Aug 23, 2018
5407de3
Merge `persistent-mysql-haskell` into `persistent-mysql-haskell-devel`.
naushadh Oct 20, 2018
7f5e5bb
Merge `master` into `persistent-mysql-haskell-devel`.
naushadh Oct 20, 2018
bc5d242
Port [#833](https://github.com/yesodweb/persistent/pull/833).
naushadh Oct 20, 2018
233f956
Bump min bound due to the `SqlBackend` fields we now populate/rely on.
naushadh Oct 20, 2018
b515480
Correct min bound.
naushadh Oct 20, 2018
f412016
Merge pull request #8 from naushadh/persistent-mysql-haskell-devel
naushadh Oct 21, 2018
c52ab47
Add insertEntityOnDuplicateKeyUpdate and insertEntityManyOnDuplicateK…
jbransen Dec 11, 2018
13c0d66
Bump version number
jbransen Dec 11, 2018
1f7d684
Add @since declarations
jbransen Dec 11, 2018
003909c
Update Changelog with link to pull request
jbransen Dec 11, 2018
386472b
Add tests for insertEntityOnDuplicateKeyUpdate and insertEntityManyOn…
jbransen Dec 19, 2018
aea8ea5
Merge pull request #9 from chordify/persistent-mysql-haskell
naushadh Dec 23, 2018
0821a5a
Address VSCode linter issues.
naushadh Jan 29, 2019
bc187ef
Fix stackage#4312: Relax network version bound.
naushadh Jan 29, 2019
5b9f487
Merge pull request #10 from naushadh/persistent-mysql-haskell-devel
naushadh Jan 29, 2019
d990e22
Merge branch 'master' into persistent-mysql-haskell-devel
naushadh Dec 19, 2019
73cc0df
Absorb latest upstream changes.
naushadh Dec 19, 2019
1a940ad
Remove invalid test.
naushadh Dec 19, 2019
b8625ba
Fix configs.
naushadh Dec 20, 2019
3adbfa8
Fix truncation tests.
naushadh Dec 20, 2019
819f432
Merge pull request #11 from naushadh/persistent-mysql-haskell-devel
naushadh Dec 28, 2019
b282893
Update to GHC 8.8, update upper package bounds
Oct 1, 2020
3feb905
Merge pull request #1 from chordify/ghc-8.8
jbransen Oct 5, 2020
e646f06
Loosened MySQL backend constraints
RikvanToor Feb 18, 2021
e45ec43
Merge pull request #2 from RikvanToor/mysql-backend
RikvanToor Mar 3, 2021
ae619ae
Merge branch 'master' into persistent-mysql-haskell
byteflood Sep 22, 2021
abd90da
merge in changes to persistent-mysql
byteflood Sep 22, 2021
943f2ce
updated tests
byteflood Sep 24, 2021
b589081
Merge branch 'master' into persistent-mysql-haskell
byteflood Oct 19, 2021
cf73558
Support new persistent version
RikvanToor Oct 27, 2022
434f492
Import `Control.Monad` in `Spec` (#1487)
9999years Jun 1, 2023
52a0ef5
Future-proof against potential Prelude.foldl' (#1501)
Bodigrim Jun 5, 2023
2a26141
Fixes name shadowing error at keyFromRecordM for Primary keys (#1496)
hw202207 Jun 27, 2023
892a9d5
Haisheng/tweak parser comment line (#1505)
hw202207 Jun 28, 2023
0bc8942
persistent-2.14.5.1
parsonsmatt Jun 28, 2023
55cc233
Allow http-api-data 0.6 (#1507)
tfausak Jul 27, 2023
c3c0145
Patch for aeson-2.2.0.0 and template-haskell-2.21 (#1513)
mpilgrem Sep 7, 2023
815dfaf
persistent-2.14.5.2
parsonsmatt Sep 7, 2023
98ee544
Create Haddocks from entity documentation comments (#1503)
blujupiter32 Sep 18, 2023
428c89f
persistent-postgresql: add `createPostgresqlPoolTailored` function (#…
ixmatus Sep 18, 2023
1e5dd49
uhhh
parsonsmatt Sep 18, 2023
eec3a32
typo: perist -> persist (#1514)
chris-martin Sep 18, 2023
a3a25eb
Bump versions for postgresql-simple and postgresql-libpq (#1516)
Vekhir Sep 19, 2023
dfd87cc
postgres(normalize types to eliminate noop migrations) (#1518)
HugoPeters1024 Sep 21, 2023
ad5585f
persistent-postgresql-2.13.6.1
parsonsmatt Sep 21, 2023
7a05b48
clarify changelog
parsonsmatt Oct 2, 2023
6ec4de1
Optionally derive `PathMultiPiece` for composite keys (#1509)
blujupiter32 Oct 3, 2023
c88f5ce
Always creates `SymbolToField "id"` instance (#1497)
hw202207 Oct 3, 2023
43d9cd3
persistent-2.15.6.0
parsonsmatt Oct 3, 2023
6194b1f
persistent-sqlite: Add `openRawSqliteConn` (#1488)
ivanbakel Oct 3, 2023
38654d9
Add keyAndEntityFieldsDatabase function to return key with migration …
josephsumabat Oct 3, 2023
e2b1a11
Add `mpsAvoidHsKeyword` in `MkPersistSettings` (#1480)
ccycle Oct 3, 2023
40f0a33
Add GHC 96 to CI (#1485)
parsonsmatt Oct 3, 2023
68b7ca7
Add quickstart example (#1483)
malteneuss Oct 3, 2023
bd32280
Handle qualified table name (#1477)
wavewave Oct 3, 2023
685def3
persistent-2.14.6.0
parsonsmatt Oct 3, 2023
b2b5c32
add open' which takes a ByteString (#1486)
joeyh Oct 4, 2023
9f9019f
persistent-qq-2.12.0.6
parsonsmatt Oct 4, 2023
3744ffb
persistent-mysql: treat tinyint as SqlOther "tinyint", not SqlBool (#…
fumieval Dec 7, 2023
7fb12cb
persistent-mysql-2.13.1.5
parsonsmatt Dec 7, 2023
7223083
Relax template-haskell upper bound for persistent (#1484)
mpilgrem Dec 7, 2023
5919537
mark as unreleased
parsonsmatt Dec 7, 2023
d0d2bec
Merge branch 'master' of github.com:yesodweb/persistent
parsonsmatt Dec 7, 2023
e2fb8d4
Upgrade Sqlite Amalgamation (#1522)
parsonsmatt Dec 7, 2023
213e904
Add Database.Persist.Sqlite.createSqlitePoolWithConfig (#1524)
ciukstar Dec 7, 2023
7c81862
persistent-sqlite-2.13.3.0
parsonsmatt Dec 7, 2023
9701360
Allow `Integral` types to parse `PersistRational` (#1528)
parsonsmatt Feb 8, 2024
a4b4890
Document the `!no-migrate` Entity Attribute (#1530)
prikhi Apr 30, 2024
201a1b9
Make it build with ghc 9.10 (#1536)
erikd Jul 19, 2024
0bdc0d2
persistent-postgresql-2.13.6.2
parsonsmatt Jul 19, 2024
f40ad2c
persistent-redis-2.13.0.2
parsonsmatt Jul 19, 2024
2f1adc0
persistent-2.14.6.2
parsonsmatt Jul 19, 2024
40ed447
cabal.project: Remove redundant allow-newer stanzas (#1543)
erikd Aug 20, 2024
24f5d92
Fix type error message with AtLeastOneUniqueKey class (#1544)
parsonsmatt Aug 28, 2024
0c74e3f
Bump libpq bounds (#1547)
parsonsmatt Sep 5, 2024
e6a0a9f
Update mongoDB backend mongoDB driver interface (#1545)
darycabrera Sep 6, 2024
a2fdcde
Update mongo repsert and replace calls (#1550)
darycabrera Sep 13, 2024
2c3cd6d
Fix typo in IsolationLevel comment (#1563)
chris-martin Jan 10, 2025
c7f4838
Fix CI (#1565)
parsonsmatt Jan 17, 2025
1c75fed
chore: fix `flake.nix` workable (#1571)
ncaq Mar 17, 2025
c6aba87
Add position info to EntityDef (#1569)
lf- Mar 17, 2025
ac0a869
Add fourmolu config and restyled (#1570)
parsonsmatt Mar 17, 2025
f3f304f
Update CI (#1572)
parsonsmatt Mar 17, 2025
44e3955
style: apply `cabal-fmt -i **/*.cabal` (#1576)
ncaq Mar 19, 2025
4aec326
Support GHC 9.8 and GHC 9.12 (#1575)
parsonsmatt Mar 20, 2025
da5f9d2
persistent-2.15.0.1
parsonsmatt Mar 21, 2025
91af69d
fix: nix build (#1577)
ncaq Mar 24, 2025
0f37df3
Merge branch 'master' of github.com:yesodweb/persistent
parsonsmatt Mar 26, 2025
cd11fbb
Fix export of keyAndEntityFieldsDatabase (#1579)
MaxGabriel Mar 31, 2025
0e34ba9
merge and do 2.15.0.1
parsonsmatt Mar 31, 2025
594a532
Document mpsFieldLabelModifier with example (#1587)
malteneuss May 7, 2025
381cc12
use Megaparsec for first-pass parsing of entity definitions (#1584)
dtpowl May 15, 2025
b5ba120
Fix missing UTC timezone "Z" in Sqlite UTCTime strings (#1585)
malteneuss May 15, 2025
4529064
Fix formatting for PersistField (#1586)
parsonsmatt May 16, 2025
55e6d53
optionally warn when encountering tabs in whitespace (#1589)
dtpowl May 19, 2025
cb6fe42
Fix “deleteBy” documentation example (add parenthesis) (#1582)
unclechu May 19, 2025
96dd8e8
Elaborate on 'upsertManyWhere' (#1537)
lfborjas May 20, 2025
9723907
persistent-2.16.0.0
parsonsmatt May 20, 2025
a85397d
Fix errant references to Database.Persist.Sql.Raw (#1593)
MaxGabriel May 22, 2025
5a49753
Add tabulateEntityApply (#1595)
parsonsmatt May 23, 2025
607b483
Bump persistent-test persistent bound
parsonsmatt Jun 4, 2025
5a9deb2
Expose Structured Mock Migrations (#1600)
mercury-kuba Jul 7, 2025
44adecb
Warn on quoted attributes (#1601)
dtpowl Jul 9, 2025
f4176c5
Format with fourmolu (#1603)
parsonsmatt Jul 10, 2025
1d109e6
Improve handling of PostgreSQL intervals (#1604)
tfausak Sep 9, 2025
d5a340e
persistent-postgresql-2.14.0.0
parsonsmatt Sep 9, 2025
44db7eb
feat: `ON DUPLICATE UPDATE x=IF(x < VALUES(x), VALUES(x), x)`
Oct 29, 2025
370c76e
Merge pull request #3 from chordify/extend-handle-update-collision
swamp-agr Nov 6, 2025
5413588
Add NoAction to CascadeAction (#1610)
mercury-kuba Dec 2, 2025
9d88bf4
Avoid N+1 in postgresql migrations (#1612)
hdgarrood Dec 11, 2025
bb5b7b5
postgresql: Add foreign key constraints the first time when migrating…
hdgarrood Dec 12, 2025
9d74016
Improve error messages around getBy with NULLABLE fields (#1608)
jkeuhlen Jan 7, 2026
855c20c
Add Configuration for Default Cascade Option for Foreign Keys (#1616)
mercury-kuba Jan 14, 2026
a896c0a
Add assignAll and copyAll
Mar 2, 2026
6086d91
Merge commit 'a896c0aab4db8bf33b01f8607a0ea588219a0c40' into persiste…
Mar 2, 2026
392faa7
Allow newer memory for mysql-haskell
Mar 2, 2026
2ea11d1
Allow newer base for word24
Mar 2, 2026
ce4d7f1
Allow newer http-api-data for persistent-mongoDB
Mar 2, 2026
e0a758f
Add assignAll and copyAll to persistent-mysql-haskell
Mar 2, 2026
c1a51f8
Remove use of toSqlKey from assignAll
Mar 3, 2026
58684eb
Merge commit 'c1a51f8db5d0db2bafd4d9b56f97d046d86fcb90' into persiste…
Mar 3, 2026
c9d9976
Remove assignAll from persistent-mysql-haskell
Mar 3, 2026
7cab128
Allow deepseq to be older instead of base to be newer
Mar 3, 2026
793e2d2
Allow all mysql-haskell deps to be newer
Mar 3, 2026
f20af0f
Remove ghc 8.8 from test matrix
Mar 3, 2026
1404710
Remove ghc 8.10 from test matrix
Mar 3, 2026
fc18d09
allow-newer for all mysql-haskell deps again
Mar 3, 2026
d578f2c
Allow older deepseq again
Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Before submitting your PR, check that you've:

- [ ] Documented new APIs with [Haddock markup](https://www.haskell.org/haddock/doc/html/index.html)
- [ ] Added [`@since` declarations](http://haskell-haddock.readthedocs.io/en/latest/markup.html#since) to the Haddock
- [ ] Ran `stylish-haskell` on any changed files.
- [ ] Adhered to the code style (see the `.editorconfig` file for details)
- [ ] Ran `fourmolu` on any changed files (`restyled` will do this for you, so
accept the suggested changes if it makes them)
- [ ] Adhered to the code style (see the `.editorconfig` and `fourmolu.yaml` files for details)

After submitting your PR:

Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cabal: ["3.6"]
cabal: ["3.12"]
ghc:
- "8.4.4"
- "8.6.5"
- "8.8.4"
- "8.10.7"
- "9.0.2"
- "9.2.4"
- "9.4.1"
- "9.0"
- "9.2"
- "9.4"
- "9.6"
- "9.8"
- "9.10"
- "9.12"

env:
CONFIG: "--enable-tests --enable-benchmarks"
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand All @@ -71,7 +71,8 @@ jobs:
with:
mongodb-version: '5.0'
- name: Start Redis
uses: supercharge/redis-github-action@1.4.0
uses: shogo82148/actions-setup-redis@v1
- run: sudo apt-get update && sudo apt-get install -y libpcre3-dev
- run: cabal v2-update
- run: cabal v2-freeze $CONFIG
- run: cat cabal.project.freeze
Expand All @@ -83,10 +84,7 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
${{ runner.os }}-${{ matrix.ghc }}-
- run: cabal v2-build all --disable-optimization --only-dependencies $CONFIG
- run: cabal v2-build all --disable-optimization $CONFIG
- run: cabal v2-test all --disable-optimization $CONFIG --test-options "--fail-on-focus"
- run: cabal v2-bench all --disable-optimization $CONFIG
- run: cabal v2-haddock all $CONFIG
continue-on-error: true
- run: cabal v2-sdist all
20 changes: 20 additions & 0 deletions .github/workflows/restyled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .github/workflows/restyled.yml

name: Restyled

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
restyled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: restyled-io/actions/setup@v4
- uses: restyled-io/actions/run@v4
with:
suggestions: true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ cabal.sandbox.config
dist-newstyle/
.ghc.environment.*

# for direnv
.envrc

# nix relation
.direnv/
.env.local
result/

## Docker image ignores
/.cabal/
/.stackage/
Expand Down
5 changes: 5 additions & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
restylers:
- cabal-fmt
- fourmolu
- stylish-haskell:
enabled: false
40 changes: 0 additions & 40 deletions .stylish-haskell.yaml

This file was deleted.

76 changes: 67 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## Learn more: http://www.yesodweb.com/book/persistent

[![Join the chat at https://gitter.im/yesodweb/persistent](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yesodweb/persistent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/yesodweb/persistent.svg?branch=master)](https://travis-ci.org/yesodweb/persistent) ![Hackage](https://img.shields.io/hackage/v/persistent.svg) ![Hackage-Deps](https://img.shields.io/hackage-deps/v/persistent.svg)
# Persistent [![Build Status](https://travis-ci.org/yesodweb/persistent.svg?branch=master)](https://travis-ci.org/yesodweb/persistent) ![Hackage](https://img.shields.io/hackage/v/persistent.svg) ![Hackage-Deps](https://img.shields.io/hackage-deps/v/persistent.svg) [![Join the chat at https://gitter.im/yesodweb/persistent](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yesodweb/persistent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A Haskell datastore. Datastores are often referred to as "ORM"s. While 'O' traditionally means object, the concept can be generalized as:

Expand All @@ -11,6 +9,69 @@ In dynamic languages rather than compile time errors, safety comes from creating

Persistent's goal is to catch every possible error at compile-time, and it comes close to that.

# Quickstart

<details>
<summary>
Click to show package.yaml part.
Learn more at <a href="https://www.yesodweb.com/book/persistent" target="_blank">http://www.yesodweb.com/book/persistent.</a>
</summary>

```yaml
dependencies:
- base ^>= 4.17
- text ^>= 2
- persistent ^>= 2.14
- persistent-sqlite ^>= 2.13
```

</details>
<p></p>

```haskell
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Control.Monad.IO.Class (liftIO)
import Database.Persist
import Database.Persist.Sqlite
import Database.Persist.TH
import Data.Text

share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Person
name Text
age Int Maybe
deriving Show
|]

main :: IO ()
main = runSqlite ":memory:" $ do
-- setup db schema
runMigration migrateAll

-- write to db
insert $ Person "Jane Doe" Nothing
johnId <- insert $ Person "John Doe" $ Just 35

-- read from db
john1 <- selectList [PersonId ==. johnId] [LimitTo 1]
john2 <- get johnId

liftIO $ print (john1 :: [Entity Person])
liftIO $ print (john2 :: Maybe Person)

-- delete from db
delete johnId
deleteWhere [PersonId ==. johnId]
```

# Backend agnostic

Supports PostgreSql, Sqlite, MongoDB, Redis, ZooKeeper, and many other databases via [persistent-odbc](https://github.com/gbwey/persistent-odbc).
Expand All @@ -27,15 +88,12 @@ Key-value stores such as Redis can be used with persistent, but only fill out th
Persistent provides several hooks to create backend-specific functionality.
One can always fall back to using the raw database driver or other lower-level or less type-safe libraries and can utilize Persistent for un-serializing the database response to a Haskell record.

# Help improve Persistent

## Install from source

Clone the repo and run `stack build` to build all targets. Persistent
To install from source clone the repo and run `stack build` to build all targets. Persistent
supports many backends. If you have only some of these installed the
[development doc](development.md) shows how to build against a subset of
targets.

## Development

For more information on how to hack ont he `persistent` set of libraries, see
For more information on how to hack on the `persistent` set of libraries, see
the [`development.md`](development.md) file.
41 changes: 28 additions & 13 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
packages:
persistent
persistent-sqlite
persistent-test
persistent-mongoDB
persistent-mysql
persistent-postgresql
persistent-redis
persistent-qq
persistent
persistent-sqlite
persistent-test
persistent-mongoDB
persistent-mysql
persistent-mysql-haskell
persistent-postgresql
persistent-redis
persistent-qq

-- GHC 9.4 shims for persistent
-- required by nix but breaks macOS cabal builds:
--package postgresql-libpq
-- flags: +use-pkg-config

-- These need hackage revisions but otherwise test fine in the repo
allow-newer:
-- https://github.com/haskellari/postgresql-simple/pull/95
, postgresql-simple:base
, postgresql-simple:template-haskell
-- https://github.com/fizruk/http-api-data/pull/146
http-api-data:base
, postgresql-simple:base
, postgresql-simple:template-haskell
, bytestring-lexing:base
, postgresql-simple-interval:persistent
, mysql-haskell:*

allow-older:
mysql-haskell:deepseq

source-repository-package
type: git
location: https://github.com/parsonsmatt/mysql
tag: 1e7dc274bf9a2919c9dd4298ed46c1bd1a1b677d
--sha256: 1zbwly28rpwkqqkj9cbsbr57rx2y79nbfcrvqmp7a0gxy0d9i4qy

-- Needed to test that `persistent-redis` works with mtl-2.3
-- https://github.com/informatikr/hedis/pull/190
Expand Down
7 changes: 3 additions & 4 deletions development.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Style Guide

## `stylish-haskell`
## `fourmolu`

This repository uses
[`stylish-haskell`](https://hackage.haskell.org/package/stylish-haskell) as an
autoformatter. `stylish-haskell` is inherently limited, so it won't handle
everything, but it will format import lists, extension lists, etc.
[`fourmolu`](https://hackage.haskell.org/package/fourmolu) as an
autoformatter.

## `editorconfig`

Expand Down
Loading
Loading