Last active
February 28, 2017 22:23
-
-
Save mbenedettini/b65aa24eb909bc0c3fb07515323a73b1 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
'use strict'; | |
let dbm; | |
let type; | |
let seed; | |
const Promise = require('bluebird'); | |
/* logger is a simple logging module that can be found here | |
https://gist.github.com/mbenedettini/a93ad95cbc352a3afd9ad7193af563d7 */ | |
const logger = require('logger'); | |
const app = require('loopback-init'); | |
/** | |
* We receive the dbmigrate dependency from dbmigrate initially. | |
* This enables us to not have to rely on NODE_PATH. | |
*/ | |
exports.setup = function(options, seedLink) { | |
dbm = options.dbmigrate; | |
type = dbm.dataType; | |
seed = seedLink; | |
}; | |
exports.up = function(db) { | |
return app.models.MyUser.find().then(users => { | |
return Promise.each(users, user => { | |
user.name = 'Joe'; | |
return user.save(); | |
}); | |
}).then(() => { | |
app.stop(); | |
}); | |
}; | |
exports.down = function(db) { | |
return null; | |
}; | |
exports._meta = { | |
"version": 1 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment