I can’t use the @id decorator in Prisma – the generator want’s the id column to be id
$ yarn rw g sdl AltIdMessage
Error 1: GraphQLDocumentError: Cannot query field "id" on type "AltIdMessage". at /Users/ajoslin/Documents/Als/Development/EPC/Development/print-on-demand-2/web/src/components/AltIdMessageCell/AltIdMessageCell.tsx:3:5
model AltIdMessage {
state String @id
msg String
}
Cells may require an id field named “id”.
import type { ${operationName} } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
export const QUERY = gql`
query ${operationName}($id: ${idType}!) {
${camelName}: ${camelName}(id: $id) {
id
}
}
`
export const Loading = () => <div>Loading...</div>
export const Empty = () => <div>Empty</div>
export const Failure = ({ error }: CellFailureProps) => (
Can you add or change your id and retry generators?
If so then please write up an issue about cells requiring a strictly names id field.
I would really recommend having a primary key that is an Int or uuid
I just started using
id Int @id @default(autoincrement())
I used to know one that generated a guid for the id
Can we return suggestions before the Error ?
Do we have a snippets/suggestion engine ?
We’re going to start bumping up against a complexity limit with what we can generate…
That’s why there is searchable Prisma docs
See Prisma Schema API and there’s also a cuid.
1 Like
Searchable Prisma docs, that’s really interesting !!
You’ve a better knowledge of all the technologies that RW brings together - how many of them have Docs API’s like Prisma ?