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

String[] arrays removed by transformation #11

@abett

Description

@abett

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions