diff --git a/packages/twenty-server/project.json b/packages/twenty-server/project.json index b3c45f24ab67..f023fef24f11 100644 --- a/packages/twenty-server/project.json +++ b/packages/twenty-server/project.json @@ -178,17 +178,30 @@ "database:reset": { "executor": "nx:run-commands", "dependsOn": ["build"], - "options": { - "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", - "nx command-no-deps -- workspace:seed:dev" - ], - "parallel": false - } + "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", + "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", + "nx command-no-deps -- workspace:seed:dev" + ], + "parallel": false + } + }, + "defaultConfiguration": "seed" } } } diff --git a/packages/twenty-server/scripts/setup-db.ts b/packages/twenty-server/scripts/setup-db.ts index 78c77397d71f..c7f744d64b80 100644 --- a/packages/twenty-server/scripts/setup-db.ts +++ b/packages/twenty-server/scripts/setup-db.ts @@ -56,7 +56,7 @@ rawDataSource ]; // See https://supabase.github.io/wrappers/ for (const wrapper of supabaseWrappers) { - if (await checkForeignDataWrapperExists(wrapper)) { + if (await checkForeignDataWrapperExists(`${wrapper.toLowerCase()}_fdw`)) { continue; } await performQuery( diff --git a/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx b/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx index 424ef37a362e..ae0185cd97ae 100644 --- a/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx +++ b/packages/twenty-website/src/content/developers/backend-development/server-commands.mdx @@ -37,7 +37,7 @@ Note : you can run `npx nx run twenty-server:test:integration:with-db-reset` in ### 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 npx nx run twenty-server:database:reset diff --git a/packages/twenty-website/src/content/developers/self-hosting/troubleshooting.mdx b/packages/twenty-website/src/content/developers/self-hosting/troubleshooting.mdx index 2e386030d99d..bff94051caf0 100644 --- a/packages/twenty-website/src/content/developers/self-hosting/troubleshooting.mdx +++ b/packages/twenty-website/src/content/developers/self-hosting/troubleshooting.mdx @@ -86,7 +86,7 @@ If you can't log in after setup: 1. Run the following commands: ```bash 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: ```bash @@ -94,6 +94,8 @@ If you can't log in after setup: 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 If you're running Twenty behind a reverse proxy and experiencing connection issues: