Bean
Explore posts from serversPPrisma
•Created by Bean on 7/12/2024 in #help-and-questions
create many skip existing
I want to createmany rows in a table, but if that row already exists (excluing the ID row), then skip that row.
afaik, the
how can I avoid this issue? I want to be able to automatically skip any rows that already exist. currently the ID key is set to
skipDuplicates
key will skip duplicates within the set of new rows you are adding, but it does not check the existing rows
eg:
if I do createMany
with skipDuplicates
and add rows:
this will result in duplicate rows but with different ID keys.how can I avoid this issue? I want to be able to automatically skip any rows that already exist. currently the ID key is set to
autoincrement()
.
What should I do?13 replies
PPrisma
•Created by Bean on 4/16/2024 in #help-and-questions
union type findMany
I want to be able to query in prisma using a variable which is a union type over mulitple model tables.
so instead of
I want to be able to do:
Since I have a really large schema and I do not want to repeat so many lines.
but, even though each model/schema table has the id field as the same type and they all have this same key, TS is complaining that the signatures of each of the
findMany
functions are different for each table so I cannot do this. .
I even tried using as const
in case there was a difference there, but that did not help either. I am not sure how I can do this to make my code cleaner and easier to maintain.
Here is an example in a codesandbox:
https://codesandbox.io/p/devbox/dark-night-vsqs7314 replies
PPrisma
•Created by Bean on 4/15/2024 in #help-and-questions
will prisma support zod validations natively
I know there are plugins, but they all seem to be out of date and have issues with them not being always correct.
I really wish this was natively integrated given how important this is to have.
it just needs more cod gen in the generate function
1 replies
PPrisma
•Created by Bean on 3/28/2024 in #help-and-questions
StringFieldUpdateOperationsInput on @id
1 replies