You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Sequelize
Hi, I'm trying to figure out the best way to bulkCreate records with foreign keys. Can somebody please give me a short example? I don't know if I should use something like this:
And should I have this in posts.js or in a migration or seed? If so, how do I access Post from the migration? I'm pretty confused and I haven't been able to find the answer in the documentation.
Mick Hansen
unread,
Oct 25, 2015, 1:39:42 PM10/25/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Nacho Caballero, Sequelize
I don't really know of any established patterns for seeding databases. As for accessing your models from a migration you should be able to import your sequelize models like in any other file since it's just a node.js file.
As for the best way to seed, that's really up to you, you can also use a series of nested create calls.