I try to sow, save to users, then get userId and paste into the accounts 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 that the result is the value of the inserted rows? How can I return the data?
source share