I'm trying to poulate my Strongloop models and relations during startup. I've created a js-script in server/boot/
but how do I initialize a hasAndBelongsToMany relation?
This is what my current setup code looks like (some parts omitted for brevity):
module.exports = function(app) {
app.dataSources.mySqlDb.automigrate(['X', 'Y'], function(err) {
app.models.X.create([{ fuu: "bar"}, (some more...)], function(err, xs) {});
app.models.Y.create([{ foo: "baz"}, (some more...)], function(err, ys) {});
});
};
In the X model (x.json) there is a hasAndBelongsToMany
relation defined to Y, but how and where can I add data to it?