I have imported 2 models, I have a mqsql join tabl...
# prisma-whats-new
m
I have imported 2 models, I have a mqsql join table as json but I am not exactly sure how to connect the 2 models, especially since Graph.Cool doesn't let you set IDs
n
@Michael create a relation in The Console first. What's the cardinality of both sides of the relation?
m
I created the relation in the console. The cardinality is many-to-many
The schema has logos and colors. The cardinality is many-to-many. In my MySQL DB I have a logos table, colors table and logoColors table which is the join and it contains an ID, LOGO_ID, COLOR_ID.
n
@Michael cool, now you can use nested mutations to create both sides of the relation at the same time if you want
or you create all nodes of one side and keep a map of old ids from your JSON to new ids From Graphcool. Then when creating the nodes of the other side, you can pass the id to the create mutation
does that make sense?
m
I think so. I also think I've just been sitting in front of the computer for too long today. I'll give that a try. Thanks
That being said, I already imports both the logos and the colors
n
you can now construct the two maps from old id to new id
and then use the addTo<relationname> mutation to connect the nodes
m
Perfect! Thanks
n
👍
let me know if that worked out 🙂