-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #514 from SheteUC/master
docs(installation): add missing pgrx initialization and database connection steps
- Loading branch information
Showing
1 changed file
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
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) | ||
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). | ||
|
||
Then clone the repo and install using | ||
Then clone the repo and install using: | ||
|
||
```bash | ||
git clone https://github.com/supabase/pg_graphql.git | ||
cd pg_graphql | ||
cargo pgrx install --release | ||
``` | ||
|
||
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. | ||
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: | ||
|
||
```bash | ||
cargo pgrx init --pg16=download | ||
``` | ||
|
||
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) | ||
|
||
To start the database: | ||
|
||
```bash | ||
cargo pgrx start pg16 | ||
``` | ||
|
||
To connect: | ||
|
||
```bash | ||
cargo pgrx connect pg16 | ||
``` | ||
|
||
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. | ||
|
||
```psql | ||
create extension pg_graphql; | ||
``` | ||
|
||
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. |