Open jeff-ong opened 2 years ago
+1 to this feature being more explicit. I'm not sure if this answer will solve your problem @jeff-ong -https://stackoverflow.com/questions/70550775/how-to-create-an-amplify-datastore-many-to-many-schema-in-version-3-7-3
I am attempting to utilise this to explicitly model the junction table created by @manyToMany
directive but it's unclear whether this is the correct pattern as, in the answer, the junction table is referenced in the directive, as opposed to being implicitly created via the relationName
argument
In fact, it's in the documentation that you must continue to use @hasMany
with @belongsTo
Note: if you want to store additional properties on the join table, or if you have an existing join table, you can continue to use two @hasMany <=> @belongsTo relationships to facilitate a many-to-many relationship.
Source: https://docs.amplify.aws/cli/migration/transformer-migration/#relationship-mappingconnection-changes
has anyone figured this out? @camin-mccluskey so hasMany from both sides is a way to go if not?
@judygab I used @hasMany
with @belongsTo
but it's been a while since I worked on this (or any) Amplify project so I've somewhat lost context
Is this related to a new or existing framework?
No response
Is this related to a new or existing API?
GraphQL API
Is this related to another service?
DynamoDB, GraphQL
Describe the feature you'd like to request
Currently, the @manyToMany directive creates a join table under the hood but it is not letting user specify a sortKey on the join table index in schema.graphql.
The schema above creates the PostTags table under the hood but is there currently a way to add a sort key to the index created in the join table.
Describe the solution you'd like
Allow user to customize the partition and sort key for join table in schema.graphql
Describe alternatives you've considered
Allow user to prevent schema.graphql from overriding manual changes in DynamoDB resources.
Additional context
No response
Is this something that you'd be interested in working on?