jamiepine / prismix

The Prisma schema mixer 🍹
GNU General Public License v3.0
304 stars 40 forks source link

Datatype array not appear after prismix generated schema.prisma #13

Open olustrrax opened 3 years ago

olustrrax commented 3 years ago

I found something that prismix not generate with the right datatype

base.prisma

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

order.prisma

model Order {
  id             Int             @id @default(autoincrement())
  ownerId        String
  ownerJson      Json
  code           String[]
  terms          String
  remark         String
  discountTotal  Int
}

schema.prisma

model Order {
  id             Int             @id @default(autoincrement())
  ownerId        String
  ownerJson      Json
  code           String
  terms          String
  remark         String
  discountTotal  Int
}

After prismix generate schema.prisma the field name code has String NOT String[]

What's wrong? How can I fix it?

jamiepine commented 3 years ago

Is String[] even valid Prisma? I'm getting an error while trying to use it, can't find much through a quick Google search for this error.

Field "code" in model "Order" can't be a list. The current connector does not support lists of primitive types.

olustrrax commented 3 years ago

@jamiepine Maybe it's because of Prisma version? I think String[] will be work (this's my ref Working with scalar lists)

Or I miss something 😅

omar-dulaimi commented 2 years ago

Scalar lists is supported by PostgreSQL only. MySQL has no support for it. So you need a table for that as explained in the schema incompatibilities doc: https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-postgres#scalar-lists-arrays-are-maintained-with-extra-table

MeguminSama commented 2 years ago

any chance of getting this implemented? lists of primitive types very much work on the postgres connector

patrick1011 commented 2 years ago

We also have this issue and it is forcing us to give up using the library. Any chance of a fix?

LServo commented 2 years ago

I'm having this problem.. any news?