Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to ignore extra fields when storing prisma data?

Tags:

prisma

I'm loading some data from a CSV file that has some extra notes fields that I don't want in the DB. Is there an option to just ignore extra fields when storing to the DB?

I think mongoose did this by default - which does have a downside that stuff goes missing without warning if your schema is wrong but... thats what i want in this case.

Otherwise what is a way to reflect and get the schema so I can remove extra fields from the data manually?

I'm getting this error on .create

Unknown arg `notes` in data.notes for type WalletCreateInput. 
Did you mean `name`? 
Available args:
...

like image 697
dcsan Avatar asked Sep 14 '25 06:09

dcsan


1 Answers

It's not allowed to add extra fields while interacting with Prisma Query.

The current behaviour is intentional and it throws the error as an extra validation layer to make sure you're passing the right data.

There is a feature request that discusses allowing extra fields while interacting with Query.

As of now, destructuring the fields which are necessary and passing only the required fields is the only option.

like image 173
Nurul Sundarani Avatar answered Sep 17 '25 20:09

Nurul Sundarani