Wednesday, March 9, 2016

seeding not getting data back

Leave a Comment

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: 'kel@test.com'     }).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?

1 Answers

Answers 1

I think you have a typo here: accountId: ''0', remove double '' before the zero

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment