any ideas on how to model this in prisma?
creating 2 tables and referencing them seems like a good approach but i am kinda confused
17 Replies
is already normalized or its kind of generic data?
generic
and 100% random
you can set a more kv type of data
or you have to go nosql
this is not an option
whats kv?
key-value
like
🤔
what will be the data type?
array?
yea
data: Array<Record<string, unknown>>
if you know the value will always be a number
you can switch from unknown to number
or whatever
still lost
how will structure the prisma model
would shape for something like
the kvs key is name you want
thanks
so something like this is possible
and like this
ye
i just know this snippet of the data
??
i dont know the complete data to talk about a better structure
the data is complex
thats just a faction i got
so to create the row i will use connectOrCreate ?
yes
you can use a transaction
or create with creating the kvs in the same object
Prisma
Relation queries (Concepts)
Prisma Client provides convenient queries for working with relations, such as a fluent API, nested writes (transactions), nested reads and relation filters.
thanks