clean up migrations
This commit is contained in:
parent
393f45a1b3
commit
94ee178c65
4 changed files with 40 additions and 38 deletions
|
|
@ -4,7 +4,20 @@ const sequential = require('promise-sequential')
|
|||
module.exports = {multi}
|
||||
|
||||
function multi (sqls, cb) {
|
||||
return sequential(sqls.map(s => db.none(s)))
|
||||
.then(cb)
|
||||
.catch(cb)
|
||||
const doQuery = s => {
|
||||
return () => {
|
||||
return db.none(s)
|
||||
.catch(err => {
|
||||
console.log(err.stack)
|
||||
throw err
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return sequential(sqls.map(doQuery))
|
||||
.then(() => cb())
|
||||
.catch(err => {
|
||||
console.log(err.stack)
|
||||
cb(err)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue