Hi guys, i got a question. ```model Stage { id ...
# orm-help
j
Hi guys, i got a question.
Copy code
model Stage {
  id        String    @id @default(cuid())
  code      String    @unique
  createdAt DateTime? @default(now())

  rewards Reward[]
}

type Reward {
  item_code String
  count Int
}
I want to make my schema like this, but an error appears:
Error validating: Composite types are not supported on Postgres.
Copy code
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}
I don’t wanna make
Reward
as a table(model in schema), since it is very small pieces. What i tried instead is 1. Make It Together
Copy code
model Stage {
  id        String    @id @default(cuid())
  code      String    @unique
  createdAt DateTime? @default(now())

  reward_item_codes String[]
  reward_item_counts Int[]
}
Probleme: i need to always check the lengths of those are equal. 2. Use Json
Copy code
model Stage {
  id        String    @id @default(cuid())
  code      String    @unique
  createdAt DateTime? @default(now())

  rewards Json
}
probleme: Unhappy that i need to make json converter at each server&front. What do you bros usually solve these kinda mundane problem in Prisma? Appreciate your ideas,
1
n
Hi @Jyn 👋 The most straightforward and recommended approach would be to store the Reward as JSON if you don’t wish to create a separate table. I have seen multiple users going with the JSON approach.