Default Primary Key in GraphQL DynamoDB Schema?

Viewed 1670

I'm creating my first schema for a new DynamoDB using graphql in AWS Amplify. I noticed many examples where there is no @key directive to define the primary key such as "Product" below:

type Inventory @model
  @key(name: "byWarehouseID", fields: ["warehouseID"], queryField: "itemsByWarehouseID")
  @key(fields: ["productID", "warehouseID"]) {
  productID: ID!
  warehouseID: ID!
  inventoryAmount: Int!
}

type Product @model {
  id: ID!
  name: String!
  orders: [Order] @connection(keyName: "byProduct", fields: ["id"])
  inventories: [Inventory] @connection(fields: ["id"])
}

Is the first field automatically used as the primary key (partition key)?

1 Answers
Related