Open decoded-satapathy opened 1 week ago
Hi @decoded-satapathy, I also got this error when I was trying to reseed the data. Have you previously seeded that data? If it's true then you should remove data first.
hello @decoded-satapathy @Chaitanya1672, I was trying to setup the project locally for the first time, and got the following issue (attached below), my machine has postgres locally running on port 5432 so i've made relevant changes to connect the db to a docker postgres container.
Asus@DESKTOP-5TBFKPS MINGW64 /d/my-git-contributions-folder/daily-code/packages/db (main) $ ./setupDB.sh =================DB Setup================= .env file exists Will you use a Local DB (L) or Cloud DB (C) L Will you use Postgres Server (P) or Docker Setup (D) D Setting up Docker time="2024-06-29T11:29:41+05:30" level=warning msg="D:\\my-git-contributions-folder\\daily-code\\packages\\db\\docker-compose.yml:
version` is obsolete"
[+] Running 1/0
✔ Container db-postgres-1 Running 0.0s
=================Container is up=================
=================Migrating DB=================
node:internal/modules/cjs/loader:1147
throw err;
^
Error: Cannot find module 'D:\my-git-contributions-folder\daily-code\node_modules\node_modules\prisma\build\index.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v20.11.0 Seeds not applied. Proceeding to seed. =================Seeding DB================= node:internal/modules/cjs/loader:1147 throw err; ^
Error: Cannot find module 'D:\my-git-contributions-folder\daily-code\node_modules\node_modules\prisma\build\index.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v20.11.0`
I am facing the same errors while using a cloud data base as well, `Asus@DESKTOP-5TBFKPS MINGW64 /d/my-git-contributions-folder/daily-code/packages/db (main) $ ./setupDB.sh =================DB Setup================= .env file exists Will you use a Local DB (L) or Cloud DB (C) C Enter the DB URI of your Cloud DB postgresql://test_owner:da8RqY4rDIX@ep-steep-waterfall-a5rgxxnl.us-east-2.aws.neon.tech/100xdevs?sslmode=require =================Migrating DB================= node:internal/modules/cjs/loader:1147 throw err; ^
Error: Cannot find module 'D:\my-git-contributions-folder\daily-code\node_modules\node_modules\prisma\build\index.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v20.11.0 Seeds not applied. Proceeding to seed. =================Seeding DB================= node:internal/modules/cjs/loader:1147 throw err; ^
Error: Cannot find module 'D:\my-git-contributions-folder\daily-code\node_modules\node_modules\prisma\build\index.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v20.11.0`
Describe the bug Database seeding fails while running the setupDB.sh script while setting the project up locally.
To Reproduce Steps to reproduce the behavior:
setupDB.sh
, I got the error that the seeding has failed due toUnique constraint failed on the fields: (`id`)
Expected behavior The expected behavior was that the script would run and the docker container running Postgres that starts would have some dummy data.
Screenshots or GIFs![image](https://github.com/code100x/daily-code/assets/115103314/82403527-755c-466e-8941-96b703ba8a0a)
Info (please complete the following information):
Additional context My hypothesis is that the seed data has some duplicate id value and the quickest solution if that's the problem is, is to reupload the dummy data from the actual database.