当初始化通过扩增出CLI新GraphQL后端,示例模式限定了与@model注释多个类型。例如...
type Blog @model {
id: ID!
name: String!
posts: [Post] @connection(name: "BlogPosts")
}
type Post @model {
id: ID!
title: String!
blog: Blog @connection(name: "BlogPosts")
comments: [Comment] @connection(name: "PostComments")
}
type Comment @model {
id: ID!
content: String
post: Post @connection(name: "PostComments")
}
Run Code Online (Sandbox Code Playgroud)
推送时,这将导致创建多个DynamoDB表(每个模型一个)。因此,在此示例中,创建了三个单独的DynamoDB表(博客,帖子和评论)
在我们的例子中,我们有一个Users模型,并且将要与用户关联二十个左右的小集合。当这些小型集合都属于一个表中的User对象时,我对于必须管理二十个不同的DynamoDB表感到不安。
From everything I'm reading it seems like AppSync is encouraging the use of multiple tables. For example, the Note in the screenshot below from the AWS AppSync documentation specifically calls …
amazon-web-services amazon-dynamodb graphql aws-appsync aws-amplify