Remove pgGraphql from setup (#7716)

## Context
This PR removes pg_graphql from the setup. It also updates the local
setup documentation accordingly.

Note: We removed local setup scripts to align with redis installation,
the setup should be much simpler since we don't rely on pg_graphql
anymore.

## Test
tested locally with docker + mac (brew) setup
This commit is contained in:
Weiko
2024-10-15 16:59:44 +02:00
committed by GitHub
parent 1de739176c
commit 7e808cf529
54 changed files with 432 additions and 2160 deletions

View File

@ -93,49 +93,70 @@ cd twenty
You should run all commands in the following steps from the root of the project.
## Step 3: Set up a PostgreSQL Database
We rely on [pg_graphql](https://github.com/supabase/pg_graphql) and recommend you use the scripts below to provision a database with the right extensions.
You can access the database at [localhost:5432](localhost:5432), with user `twenty` and password `twenty` .
<ArticleTabs label1="Linux" label2="Mac OS" label3="Windows (WSL)">
<ArticleTab>
<b>Option 1:</b> To provision your database locally:
Use the following link to install Postgresql on your Linux machine: [Postgresql Installation](https://www.postgresql.org/download/linux/)
```bash
make postgres-on-linux
psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;"
```
<b>Option 2:</b> If you have docker installed:
```bash
make postgres-on-docker
docker run \
--name twenty_postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=default \
-v twenty_db_data:/var/lib/postgresql/data \
-p 5432:5432 \
twentycrm/twenty-postgres:latest
```
</ArticleTab>
<ArticleTab>
<b>Option 1:</b> To provision your database locally with `brew`:
```bash
make postgres-on-macos-intel #for intel architecture
make postgres-on-macos-arm #for M1/M2/M3 architecture
```bash
brew install postgresql@16
export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"
psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;"
```
<b>Option 2:</b> If you have docker installed:
```bash
make postgres-on-docker
docker run \
--name twenty_postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=default \
-v twenty_db_data:/var/lib/postgresql/data \
-p 5432:5432 \
twentycrm/twenty-postgres:latest
```
</ArticleTab>
<ArticleTab>
All the following steps are to be run in the WSL terminal (within your virtual machine)
<b>Option 1:</b> To provision your database locally:
<b>Option 1:</b> To provision your Postgresql locally:
Use the following link to install Postgresql on your Linux virtual machine: [Postgresql Installation](https://www.postgresql.org/download/linux/)
```bash
make postgres-on-linux
psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;"
```
Note: you might need to run `sudo apt-get install build-essential` before running the above command if you don't have the build tools installed.
<b>Option 2:</b> If you have docker installed:
Running Docker on WSL adds an extra layer of complexity.
Only use this option if you are comfortable with the extra steps involved, including turning on [Docker Desktop WSL2](https://docs.docker.com/desktop/wsl).
```bash
make postgres-on-docker
docker run \
--name twenty_postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=default \
-v twenty_db_data:/var/lib/postgresql/data \
-p 5432:5432 \
twentycrm/twenty-postgres:latest
```
</ArticleTab>
</ArticleTabs>
@ -154,7 +175,7 @@ Twenty requires a redis cache to provide the best performances
```
</ArticleTab>
<ArticleTab>
<b>Option 1:</b>To provision your Redis locally with `brew`:
<b>Option 1:</b> To provision your Redis locally with `brew`:
```bash
brew install redis
```

View File

@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS "githubReleases" (
"tagName" text PRIMARY KEY NOT NULL,
"publishedAt" date NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "githubStars" (
"timestamp" timestamp DEFAULT now() NOT NULL,
"numberOfStars" integer
);

View File

@ -0,0 +1,388 @@
{
"id": "b3a89784-eb82-49d8-b081-31c49e6906dc",
"prevId": "a7895a79-44a3-4fad-b750-f89d8c04d85c",
"version": "5",
"dialect": "pg",
"tables": {
"githubReleases": {
"name": "githubReleases",
"schema": "",
"columns": {
"tagName": {
"name": "tagName",
"type": "text",
"primaryKey": true,
"notNull": true
},
"publishedAt": {
"name": "publishedAt",
"type": "date",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"githubStars": {
"name": "githubStars",
"schema": "",
"columns": {
"timestamp": {
"name": "timestamp",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"numberOfStars": {
"name": "numberOfStars",
"type": "integer",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"issueLabels": {
"name": "issueLabels",
"schema": "",
"columns": {
"issueId": {
"name": "issueId",
"type": "text",
"primaryKey": false,
"notNull": false
},
"labelId": {
"name": "labelId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"issueLabels_issueId_issues_id_fk": {
"name": "issueLabels_issueId_issues_id_fk",
"tableFrom": "issueLabels",
"tableTo": "issues",
"columnsFrom": [
"issueId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"issueLabels_labelId_labels_id_fk": {
"name": "issueLabels_labelId_labels_id_fk",
"tableFrom": "issueLabels",
"tableTo": "labels",
"columnsFrom": [
"labelId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"issues": {
"name": "issues",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"externalId": {
"name": "externalId",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"createdAt": {
"name": "createdAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"updatedAt": {
"name": "updatedAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"closedAt": {
"name": "closedAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"authorId": {
"name": "authorId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"issues_authorId_users_id_fk": {
"name": "issues_authorId_users_id_fk",
"tableFrom": "issues",
"tableTo": "users",
"columnsFrom": [
"authorId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"labels": {
"name": "labels",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"externalId": {
"name": "externalId",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"color": {
"name": "color",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"pullRequestLabels": {
"name": "pullRequestLabels",
"schema": "",
"columns": {
"pullRequestExternalId": {
"name": "pullRequestExternalId",
"type": "text",
"primaryKey": false,
"notNull": false
},
"labelId": {
"name": "labelId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"pullRequestLabels_pullRequestExternalId_pullRequests_id_fk": {
"name": "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk",
"tableFrom": "pullRequestLabels",
"tableTo": "pullRequests",
"columnsFrom": [
"pullRequestExternalId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"pullRequestLabels_labelId_labels_id_fk": {
"name": "pullRequestLabels_labelId_labels_id_fk",
"tableFrom": "pullRequestLabels",
"tableTo": "labels",
"columnsFrom": [
"labelId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"pullRequests": {
"name": "pullRequests",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"createdAt": {
"name": "createdAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"updatedAt": {
"name": "updatedAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"closedAt": {
"name": "closedAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"mergedAt": {
"name": "mergedAt",
"type": "text",
"primaryKey": false,
"notNull": false
},
"authorId": {
"name": "authorId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"pullRequests_authorId_users_id_fk": {
"name": "pullRequests_authorId_users_id_fk",
"tableFrom": "pullRequests",
"tableTo": "users",
"columnsFrom": [
"authorId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"avatarUrl": {
"name": "avatarUrl",
"type": "text",
"primaryKey": false,
"notNull": false
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"isEmployee": {
"name": "isEmployee",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}