From 6e184d651dcf36dfdfca4bd8c10fcd6033a410d2 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 30 Nov 2017 12:14:25 +0000 Subject: [PATCH 1/3] Postgres test instructions --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index d6a7419d7..bc9931a48 100644 --- a/README.md +++ b/README.md @@ -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. From 355a26de025c5d370ec5737aa1e5a7c777e1332e Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 30 Nov 2017 12:14:25 +0000 Subject: [PATCH 2/3] Postgres test instructions --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index d6a7419d7..e8014b60e 100644 --- a/README.md +++ b/README.md @@ -240,3 +240,37 @@ 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. From 881d9e8eb7265b0cf4e213f8e17391b986eb44ea Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 30 Nov 2017 15:40:31 +0000 Subject: [PATCH 3/3] Postgres test instructions with brew instructions --- README.md | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ec9a9b2c3..3f8356450 100644 --- a/README.md +++ b/README.md @@ -244,29 +244,34 @@ In order to use these functions, you need to explicitly import their correspondi ### Tests and Postgres -To ```stack test``` with Postgresql you'll need to set the Postgres flag to true in esqueleto.cabal +To ```stack test``` with Postgresql you'll need to set the Postgres flag for [esqueleto.cabal](esqueleto.cabal) +Do this from the command line with: ```stack test --flag esqueleto:postgresql``` + +If you don't have Postgres install it. +Using apt-get it's just: ``` -Flag postgresql - Description: test postgresql. default is to test sqlite. - Default: False +sudo apt-get install postgresql postgresql-contrib +sudo apt-get install libpq-dev ``` -If you don't have Postgres install it. Using apt-get it's just: +Using homebrew on OSx ``` -sudo apt-get install postgresql postgresql-contrib -sudo apt-get install libpq-dev +brew install postgresql +brew install libpq ``` -The connection details are located near the bottom of the test/Test.hs file: +Detailed instructions on the Postgres wike [here](https://wiki.postgresql.org/wiki/Detailed_installation_guides) + +The connection details are located near the bottom of the [test/Test.hs](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: +You can change these if you like but to just get them working set up as follows on linux: ```$ sudo -u postgres createuser esqutest``` @@ -277,4 +282,17 @@ $ sudo -u postgres psql postgres=# \password esqutest ``` -Now ```stack test``` should envoke and pass all the Postgres tests. \ No newline at end of file + +And on osx + +```$ createuser esqutest``` + +```$ createdb esqutest``` + +``` +$ psql postgres +postgres=# \password esqutest +``` + + +Now ```stack test --flag esqueleto:postgresql``` should envoke and pass all the Postgres tests. \ No newline at end of file