Skip to content

Commit 0c37c46

Browse files
authored
Merge pull request #2442 from sjwmoveon/patch-2
Add instructions for local postgres
2 parents 2a9cdaa + 6c261a4 commit 0c37c46

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

docs/HOWTO_USE_POSTGRESQL.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33
To use Postgresql, follow these steps:
44

55
1. Either install docker (recommended) or postgresql on your machine:
6-
* If you installed docker run the database using: `docker compose up`
7-
* If you installed postgres locally, create the spoke dev database: `psql -c "create database spokedev;"`
8-
* Then create a spoke user to connect to the database with `createuser -P spoke` with password "spoke" (to match the credentials in the .env.example file)
6+
* If you installed docker run the database using: `docker-compose up`
7+
* If you installed postgres locally (or if you already have a local installation of postgres), create the spoke dev database: `psql -c "create database spokedev;"`
8+
* Then create a spoke user to connect to the database with `psql -d spokedev -c "create user spoke with password 'spoke';"` (to match the credentials in the .env.example file)
9+
* Grant permissions to the new Spoke user:
10+
* `psql -d spokedev -c "GRANT ALL PRIVILEGES ON DATABASE spokedev TO spoke;"`
11+
* `psql -d spokedev -c "GRANT ALL PRIVILEGES ON schema public TO spoke;"`
12+
* Create a test database by running the following commands:
13+
```
14+
psql -d spokedev
15+
CREATE DATABASE spoke_test;
16+
CREATE USER spoke_test WITH PASSWORD 'spoke_test';
17+
GRANT ALL PRIVILEGES ON DATABASE spoke_test TO spoke_test;
18+
```
919
1. In `.env` set `DB_TYPE=pg`. (Otherwise, you will use sqlite.)
1020
2. Set `DB_PORT=5432`, which is the default port for Postgres.
1121

0 commit comments

Comments
 (0)