Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

String[] arrays removed by transformation #11

Open
abett opened this issue Nov 2, 2020 · 0 comments
Open

String[] arrays removed by transformation #11

abett opened this issue Nov 2, 2020 · 0 comments

Comments

@abett
Copy link

abett commented Nov 2, 2020

Problem:

It seems that upon running npx prisma-schema-transformer, my String[] fields are being written back simply as String, which causes GraphQL queries to fail subsequently.

model App {
  app_id                   String           @id @default(dbgenerated())
  languages                String[]

  @@map("app")
}

becomes

model App {
  app_id                   String           @id @default(dbgenerated())
  languages                String

  @@map("app")
}

Error Message:

Just for reference, the error I received was:

{
  "errors": [
    {
      "message": "\nInvalid `prisma.app.findFirst()` invocation in\n/opt/app/prisma/generated/type-graphql/resolvers/crud/App/AppCrudResolver.ts:33:27\n\n\n  Attempted to serialize scalar '[String(\"EN\")]' with incompatible type 'String'",
    }
  ],
  ...
}

Workaround:

Running npx prisma introspect again helped me to write the types back as they were.
However, since they were re-added, I had to remove my knex migration tables manually.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant