daily-code icon indicating copy to clipboard operation
daily-code copied to clipboard

bug: Not able to run repo in dev mode.

Open vr1Ravi opened this issue 10 months ago • 6 comments

Describe the bug While following all the instruction given on redme file to start this repo, when running yarn prisma db seed

getting an error :-

PrismaClientKnownRequestError: Invalid db.track.create() invocation in A:\daily-code\packages\db\prisma\seed.ts:9:32

6 const promises: Promise[] = []; 7 seedsData.forEach((seed) => { 8 if (!hashID.includes(seed.data.id)) { → 9 const promise = db.track.create( Unique constraint failed on the fields: (id)

To Reproduce

Just clone the repo try running it locally. When you come to yarn prisma db seed, you might see error in console.

Screenshots or GIFs Screenshot 2024-04-20 180412

vr1Ravi avatar Apr 20 '24 12:04 vr1Ravi

I think your DB is already populated check by using yarn prisma studio in db folder. Error is there is already a track present with the same ID.

ShubhamMewara avatar Apr 20 '24 13:04 ShubhamMewara

I can see the models, but inside categories there is 0 record.

Screenshot 2024-04-20 185039

while leads ui to this

Screenshot 2024-04-20 185240 as we can see empty div below Laerning paths. could you tell me what I'm missing.

vr1Ravi avatar Apr 20 '24 13:04 vr1Ravi

just reset your db or delete all data and run seed again. or comment/delete seedsData.forEach in seed.ts

ShubhamMewara avatar Apr 20 '24 15:04 ShubhamMewara

try latest version @vr1Ravi use .sh file and try to use the docker container it works fine for me

kumarsahil01 avatar Apr 21 '24 22:04 kumarsahil01

for this you should reset the migrate.The command for that is "npm run prisma migrate reset" and it should work fine.

Ameerjafar avatar May 05 '24 04:05 Ameerjafar

@vr1Ravi , I too faced this issue during seed process. I tried deleting the db and reseting it but, I didnt find the solution appropriate. That's why I changed the seed.ts file with using upsert for every db table edit, from then on I am not facing issue with this problem. I have raised a PR #424 for the same.

dishak avatar May 16 '24 17:05 dishak