You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this feature request related to a new or existing Amplify category?
api
Is this related to another service?
No response
Describe the feature you'd like to request
This is a bug/feature
I can set the index on hasMany as follows
type User {
is: ID!
posts: [Posts] @hasMany(indexName: "byUser")
}
type Post {
id: ID!
userId: ID! @index(name: "byUser")
user: User @belongsTo(fields: "userId")
}
If I look at the query generated for Post it will look something like
query GetPost($id: ID!) {
getPost(id: $id) {
id
userId
user {
id
posts {
nextToken
}
}
createdAt
updatedAt
userPostsId
}
}
Notice that userPostsId is being created when it isn't needed.
Describe the solution you'd like
I would suggest two changes
Add the ability to set the foreign key name in hasMany
If an index is references in HasMany then use the fields for that index as the foreign key
Describe alternatives you've considered
Living with the autogenerated key names but this makes the code not as neat as it can be for my use case
Closing due to inactivity. @johnf if you are still experiencing this issue please reply back to this thread and we can re-open to investigate further 🙂
Is this feature request related to a new or existing Amplify category?
api
Is this related to another service?
No response
Describe the feature you'd like to request
This is a bug/feature
I can set the index on hasMany as follows
If I look at the query generated for Post it will look something like
Notice that userPostsId is being created when it isn't needed.
Describe the solution you'd like
I would suggest two changes
Describe alternatives you've considered
Living with the autogenerated key names but this makes the code not as neat as it can be for my use case
Additional context
@edwardfoyle this looks like it might be similar to #8557
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: