Can i use uuid() for primary key? What if a collis...
# orm-help
h
Can i use uuid() for primary key? What if a collision occurs? Does prisma detect that and retries?
r
Yes you can. There will never be a collision when using UUID’s that Prisma generates.
h
How does prisma acheive that? Does it generate and check if it is unique in db? And redraws a new uuid if it collides?
d
Prisma uses uuid v4, collisions are exceptionally rare. If you’d ever get one, you’d see a unique constraint violation error. Prisma doesn’t retry.
h
Ok, so to be sure i should catch that error and retry then?
r
You will never get a collision even if you have more than 10 million records.
h
Ok thx.