Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
exports.seed = function(knex, Promise) {
var players = knex('players');
var users = knex('users');
return new Promise(function(resolve, reject) {
Promise.resolve([
[players.del],
[users.del],
[users.insert, {id: 1, name: 'Joaozin'}],
[players.insert, {id: 1, name: 'JoaozinPlayer', user_id: 1}],
[users.insert, {id: 2, name: 'Mariazinha'}],
[players.insert, {id: 2, name: 'MariazinhaPlayer', user_id: 2}],
[users.insert, {id: 3, name: 'Joaquinzinho'}],
[users.insert, {id: 3, name: 'JoaquinzinhoPlayer', user_id: 3}]
]).map(function(exec){
return exec[1].call(exec[1], exec[2]);
}, {concurrency: 1}).then(function(execs){
resolve(execs);
}).catch(function(err){
reject(err);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.