Last active
March 26, 2016 23:19
-
-
Save seansean11/c37d4d3005e9bfa6fb6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 PROMISE CHAIN // | |
exports.seed = (knex) => | |
knex('user_role').del() | |
.then(() => knex.insert(data.user_roles).into('user_role')) | |
.then(() => knex('user_address').del()) | |
.then(() => knex.insert(data.user_addresses).into('user_address')) | |
.then(() => knex('user').del()) | |
.then(() => knex.insert(data.users).into('user')); | |
// ES5 PROMISE CHAIN // | |
exports.seed = function(knex, Promise) { | |
return knex('user_role').del() | |
.then(function() { | |
return knex.insert(data.user_roles).into('user_role'); | |
}) | |
.then(function() { | |
return knex('user_address').del() | |
}) | |
.then(function() { | |
return knex.insert(data.user_addresses).into('user_address'); | |
}) | |
.then(function() { | |
return knex('user').del(); | |
}); | |
.then(function() { | |
return knex.insert(data.users).into('user'); | |
}); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment