Scalar Lists in PlanetScale not supported

I would like to use scalar lists but as of now PlanetScale doesn't support this. Is there a way I can achieve this functionality or any workarounds anyone knows of?
model Example {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
exList String[]
}
model Example {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
exList String[]
}
Field "postTags" in model "Example" can't be a list. The current connector does not support lists of primitive types.
Field "postTags" in model "Example" can't be a list. The current connector does not support lists of primitive types.
3 Replies
Janic
Janic2y ago
I highly recommend using a supported connector like Postgres or MySQL since it supports more features you are looking for. There is no real work-around without caveats.
Poyraz
Poyraz2y ago
I used to JSON.stringify(data) on POST and parse with JSON.parse(data) on GET but like Janic already mentioned a list-supporting connector would be an easier and more stable as JSON.stringify has its own weird caveats such as no undefined etc.
mattddean
mattddean2y ago
You can always just create another table and one-to-many relate to form your array. That’s a very typical relational model It’s okay if your new post_tag table only has one column, like value. You can even make it a many-to-many relation where value is unique, then let’s say in the future you need to find all of the posts with tag “new,” that becomes trivial to query
Want results from more Discord servers?
Add your server