GraphQL Schema is using "@key" directive from an older version of the GraphQL Transformer

33 views Asked by At

i am facing this issue when i update schema and write amplify push

Your GraphQL Schema is using "@key" directive from an older version of the GraphQL Transformer. Visit https://docs.amplify.aws/cli/migration/transformer-migration/ to learn how to migrate your GraphQL schema.

My version: 12.10.0

type User
  @model
  @auth(rules: [{ allow: owner, operations: [create, read, update, delete] }])
{
  id: ID! @primaryKey
  username: String!
  email: String!
  orders: [Order] @hasMany(indexName: "byUser")
  car: Car @hasOne
}

type Car
  @model
  @auth(rules: [{ allow: owner, operations: [create, read, update, delete] }])
  @key(name: "byUser", fields: ["userId"])
{
  id: ID! @primaryKey
  type: String!
  latitude: Float
  longitude: Float
  heading: Float
  isActive: Boolean
  orders: [Order] @hasMany(indexName: "byCar")
  userId: ID!
  user: User @belongsTo(fields: ["userId"])
}

type Order
  @model
  @key(name: "byUser", fields: ["userId"])
  @key(name: "byCar", fields: ["carId", "createdAt"])
  @auth(rules: [{ allow: owner, operations: [create, read, update, delete] }])
{
  id: ID! @primaryKey
  createdAt: String!
  
  type: String!
  status: String

  originLatitude: Float!
  originLongitude: Float!

  destLatitude: Float!
  destLongitude: Float!

  userId: ID!
  user: User @belongsTo(fields: ["userId"])

  carId: ID!
  car: Car @belongsTo(fields: ["carId"])
}

0

There are 0 answers