Add no-seed configuration to database:reset (#9112)

Based on feedback here:
https://github.com/twentyhq/twenty/issues/9109#issuecomment-2550198035
This commit is contained in:
Félix Malfait 2024-12-18 11:44:06 +01:00 committed by GitHub
parent deb37edd7c
commit 45214fe548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 14 deletions

View File

@ -178,7 +178,18 @@
"database:reset": { "database:reset": {
"executor": "nx:run-commands", "executor": "nx:run-commands",
"dependsOn": ["build"], "dependsOn": ["build"],
"options": { "configurations": {
"no-seed": {
"cwd": "packages/twenty-server",
"commands": [
"nx ts-node-no-deps -- ./scripts/truncate-db.ts",
"nx ts-node-no-deps -- ./scripts/setup-db.ts",
"nx database:migrate",
"nx command-no-deps -- cache:flush"
],
"parallel": false
},
"seed": {
"cwd": "packages/twenty-server", "cwd": "packages/twenty-server",
"commands": [ "commands": [
"nx ts-node-no-deps -- ./scripts/truncate-db.ts", "nx ts-node-no-deps -- ./scripts/truncate-db.ts",
@ -189,6 +200,8 @@
], ],
"parallel": false "parallel": false
} }
},
"defaultConfiguration": "seed"
} }
} }
} }

View File

@ -56,7 +56,7 @@ rawDataSource
]; // See https://supabase.github.io/wrappers/ ]; // See https://supabase.github.io/wrappers/
for (const wrapper of supabaseWrappers) { for (const wrapper of supabaseWrappers) {
if (await checkForeignDataWrapperExists(wrapper)) { if (await checkForeignDataWrapperExists(`${wrapper.toLowerCase()}_fdw`)) {
continue; continue;
} }
await performQuery( await performQuery(

View File

@ -37,7 +37,7 @@ Note : you can run `npx nx run twenty-server:test:integration:with-db-reset` in
### Resetting the database ### Resetting the database
If you want to reset the database, you can run the following command: If you want to reset and seed the database, you can run the following command:
```bash ```bash
npx nx run twenty-server:database:reset npx nx run twenty-server:database:reset

View File

@ -86,7 +86,7 @@ If you can't log in after setup:
1. Run the following commands: 1. Run the following commands:
```bash ```bash
docker exec -it twenty-server-1 yarn docker exec -it twenty-server-1 yarn
docker exec -it twenty-server-1 npx nx database:reset docker exec -it twenty-server-1 npx nx database:reset --configuration=no-seed
``` ```
2. Restart the Docker containers: 2. Restart the Docker containers:
```bash ```bash
@ -94,6 +94,8 @@ If you can't log in after setup:
docker-compose up -d docker-compose up -d
``` ```
Note the database:reset command will completely erase your database and recreate it from scratch.
#### Connection Issues Behind a Reverse Proxy #### Connection Issues Behind a Reverse Proxy
If you're running Twenty behind a reverse proxy and experiencing connection issues: If you're running Twenty behind a reverse proxy and experiencing connection issues: