Last active
December 16, 2022 17:16
-
-
Save jaunesarmiento/00f9d6143437abe6d996872048c660a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Message | |
@model | |
@key(name: "byChannelID", fields: ["channelID", "createdAt"], queryField: "messagesByChannelID") { | |
id: ID! | |
channelID: ID! | |
author: String! | |
body: String! | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
} |
I'm still on the way. From new amplify GraphQL Transformer version 2,
@key
directive is outdated, I modified your code like following then amplify push has passed. ` type Message @model {id: ID! channelID: ID! @Index(name: "byChannelID", sortKeyFields: ["createdAt"], queryField: "messagesByChannelID" ) author: String! body: String! createdAt: AWSDateTime updatedAt: AWSDateTime } `
references https://aws.amazon.com/blogs/mobile/aws-amplify-announces-the-new-graphql-transformer-v2-more-feature-rich-flexible-and-extensible/ https://docs.amplify.aws/cli/graphql/data-modeling/#configure-a-primary-key
Thanks for the V2 code, was struggling to solve the doubt.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm still on the way. From new amplify GraphQL Transformer version 2,
@key
directive is outdated, I modified your code like following then amplify push has passed.`
type Message
@model {
id: ID!
channelID: ID! @Index(name: "byChannelID", sortKeyFields: ["createdAt"], queryField: "messagesByChannelID" )
author: String!
body: String!
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
`
references
https://aws.amazon.com/blogs/mobile/aws-amplify-announces-the-new-graphql-transformer-v2-more-feature-rich-flexible-and-extensible/
https://docs.amplify.aws/cli/graphql/data-modeling/#configure-a-primary-key