I am trying to seed, save in users then get the userId and insert into account table:
exports.seed = function(knex, Promise) {
return Promise.join(
// Deletes ALL existing entries
knex('users').del(),
knex('accounts').del(),
// Inserts seed entries
knex('users').insert({
uerId: '1231231',
email: '[email protected]'
}).then(function(result){
knex('accounts').insert({
accountId: '0',
userId: result[0].userId
});
})
);
};
But the problem is the result getting is the inserted rows value? How can I get back the data?
I think you have a typo here: accountId: ''0',
remove double '' before the zero
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With