Skip to content

Commit 8b36c68

Browse files
authored
Merge pull request #514 from SheteUC/master
docs(installation): add missing pgrx initialization and database connection steps
2 parents 20082ea + 01fe728 commit 8b36c68

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

docs/installation.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1-
First, install [pgrx](https://github.com/tcdi/pgrx) by running `cargo install --locked cargo-pgrx@version`, where version should be compatible with the [pgrx version used by pg_graphql](https://github.com/supabase/pg_graphql/blob/master/Cargo.toml#L16)
1+
First, install [pgrx](https://github.com/tcdi/pgrx) by running `cargo install --locked cargo-pgrx@version`, where version should be compatible with the [pgrx version used by pg_graphql](https://github.com/supabase/pg_graphql/blob/master/Cargo.toml#L16).
22

3-
Then clone the repo and install using
3+
Then clone the repo and install using:
44

55
```bash
66
git clone https://github.com/supabase/pg_graphql.git
77
cd pg_graphql
88
cargo pgrx install --release
99
```
1010

11-
To enable the extension in PostgreSQL we must execute a `create extension` statement. The extension creates its own schema/namespace named `graphql` to avoid naming conflicts.
11+
Before enabling the extension you need to initialize `pgrx`. The easiest way to get started is to allow `pgrx` to manage its own version/s of Postgres:
12+
13+
```bash
14+
cargo pgrx init --pg16=download
15+
```
16+
17+
For more advanced configuration options, like building against an existing Postgres installation from e.g. Homebrew, see the [pgrx docs](https://github.com/pgcentralfoundation/pgrx)
18+
19+
To start the database:
20+
21+
```bash
22+
cargo pgrx start pg16
23+
```
24+
25+
To connect:
26+
27+
```bash
28+
cargo pgrx connect pg16
29+
```
30+
31+
Finally, to enable the `pg_graphql` extension in Postgres, execute the `create extension` statement. This extension creates its own schema/namespace named `graphql` to avoid naming conflicts.
1232

1333
```psql
1434
create extension pg_graphql;
1535
```
36+
37+
These steps ensure that `pgrx` is properly initialized, and the database is started and connected before attempting to install and use the `pg_graphql` extension.

0 commit comments

Comments
 (0)