Hi Guys How do i create an array for a field with...
# orm-help
t
Hi Guys How do i create an array for a field with prisma schema model?
1
m
Hi @Taofiq, I would like to help you, I'm learning prisma aswell... Do you need an array of what type? for example I have a model User, and a model Property. In my case, each "user" can have more than one property assigned, and I'm declaring it this way and it's working:
Copy code
model User {
  id       Int     @id @default(autoincrement())
  ...  
  properties Property[]    (nothing else here)
  ....
}
Hoping this small example helps or guides you!
t
Hi @Marcos Iglesias Thank you so much for your help
I am creating a model for a product and want to have a price field that takes in an array of numbers for the product
Like fish having a price array of four price [$1, $2, $3, $4]
m
if you are going to store them as text, cause of the "$", the its a String[] for example, if you are NOT going to store the "$", you can declare it as an Int[], for example. You are more than welcome!