'How can I add a field to relational table in amplify graphql?

I work with Amplify/graphQl transformer V2, I try to do the same things like the official documentation of Amplify : https://docs.amplify.aws/cli/graphql/data-modeling/#many-to-many-relationship

So in the part of @manyToMany relationship, I understand that the relational Table generated automatically and in amplify studio I found all queries and mutaions... of this table.

My question is how can I add some filds in this table (relationalTable).

N.B : I'm using the same example of the documentation : https://docs.amplify.aws/cli/graphql/data-modeling/#many-to-many-relationship so how can I add for example the fild City in the PostTags table ?

type Post @model {
id: ID!
title: String!
content: String
tags: [Tag] @manyToMany(relationName: "PostTags")
}



type Tag @model {
id: ID!
label: String!
posts: [Post] @manyToMany(relationName: "PostTags")
}


Solution 1:[1]

try this below, I think it meets your need.

type Post @model {
  id: ID!
  title: String!
  content: String
  tags: [Tag] @hasMany
}

type Tag @model {
  id: ID!
  label: String!
  posts: [Post] @hasMany
}

type PostTags @model {
  id: ID!
  city: String!
  post_id: ID!
  tag_id: ID!
  post: Club! @belongsTo(fields: ["post_id"])
  tag: Championship! @belongsTo(fields: ["tag_id"])
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexandre FERREIRA