Postgres test instructions

This commit is contained in:
tim 2017-11-30 12:14:25 +00:00
parent 91ea0b0fca
commit 6e184d651d

View File

@ -240,3 +240,34 @@ There are many differences between SQL syntax and functions supported by differe
- PostgreSQL: `Database.Esqueleto.PostgreSQL`
In order to use these functions, you need to explicitly import their corresponding modules.
### Tests and Postgres
To ```stack test``` with Postgresql you'll need to set the Postgres flag to true in esqueleto.cabal
```Flag postgresql
Description: test postgresql. default is to test sqlite.
Default: False```
If you don't have Postgres install it. Using apt-get it's just:
```sudo apt-get install postgresql postgresql-contrib
sudo apt-get install libpq-dev```
The connection details are located near the bottom of the test/Test.hs file:
```#if defined(WITH_POSTGRESQL)
withPostgresqlConn "host=localhost port=5432 user=esqutest password=esqutest dbname=esqutest"```
You can change these if you like but to just get them working set up as follows:
```$ sudo -u postgres createuser esqutest```
```$ sudo -u postgres createdb esqutest```
```$ sudo -u postgres psql
postgres=# \password esqutest
```
Now ```stack test``` should envoke and pass all the Postgres tests.