Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to migrate when running sails lift? #72

Open
jbcpollak opened this issue Dec 11, 2015 · 1 comment
Open

How to migrate when running sails lift? #72

jbcpollak opened this issue Dec 11, 2015 · 1 comment

Comments

@jbcpollak
Copy link

How can we integrate this project with sails so migrations run when we run sails lift?

I tried setting this in config/bootstrap.js:

var sailsMigrations = require('sails-migrations');

module.exports.bootstrap = function(cb) {

    console.log('Performing Database Migrations');
    sailsMigrations.migrate();

    // It's very important to trigger this callback method when you are finished
    // with the bootstrap!  (otherwise your server will never lift, since it's waiting on the bootstrap)
    cb();
};

but I get these errors:

error: The bootstrap function threw an error after its callback was called :: TypeError: Cannot read property 'http' of undefined
    at Sails.getHost (/Users/josh/src/project/node_modules/sails/lib/app/private/getHost.js:11:43)
    at Sails.bound [as getHost] (/Users/josh/src/project/node_modules/lodash/dist/lodash.js:729:21)
    at Sails.getBaseurl (/Users/josh/src/project/node_modules/sails/lib/app/getBaseurl.js:19:20)
    at Sails.bound [as getBaseurl] (/Users/josh/src/project/node_modules/lodash/dist/lodash.js:729:21)
    at _printSuccessMsg (/Users/josh/src/project/node_modules/sails/lib/app/lift.js:63:56)
    at sailsReady (/Users/josh/src/project/node_modules/sails/lib/app/lift.js:43:5)
    at /Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:251:17
    at /Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:154:25
    at /Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:248:21
    at /Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:612:34
    at afterBootstrap (/Users/josh/src/project/node_modules/sails/lib/app/private/initialize.js:57:5)
    at bootstrapDone (/Users/josh/src/project/node_modules/sails/lib/app/private/bootstrap.js:51:14)
    at Object.module.exports.bootstrap (/Users/josh/src/project/config/bootstrap.js:22:2)
    at Sails.runBootstrap (/Users/josh/src/project/node_modules/sails/lib/app/private/bootstrap.js:44:25)
    at Sails.bound [as runBootstrap] (/Users/josh/src/project/node_modules/lodash/dist/lodash.js:729:21)
    at Sails.initialize (/Users/josh/src/project/node_modules/sails/lib/app/private/initialize.js:48:9) [TypeError: Cannot read property 'http' of undefined]
/Users/josh/src/project/node_modules/sails/lib/hooks/cors/index.js:113
        if (sails.config.cors.securityLevel > sails.hooks.cors.SECURITY_LEVEL_NORMAL) {
                                                              ^

TypeError: Cannot read property 'SECURITY_LEVEL_NORMAL' of undefined
    at Sails.<anonymous> (/Users/josh/src/project/node_modules/sails/lib/hooks/cors/index.js:113:63)
    at emitNone (events.js:72:20)
    at Sails.emit (events.js:166:7)
    at Sails.emitter.emit (/Users/josh/src/project/node_modules/sails/lib/app/private/after.js:50:11)
    at Router.flush (/Users/josh/src/project/node_modules/sails/lib/router/index.js:336:9)
    at Router.bound (/Users/josh/src/project/node_modules/lodash/dist/lodash.js:729:21)
    at Router.load (/Users/josh/src/project/node_modules/sails/lib/router/index.js:115:8)
    at Array.bound (/Users/josh/src/project/node_modules/lodash/dist/lodash.js:729:21)
    at listener (/Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:490:46)
    at /Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:441:17
    at _each (/Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:46:13)
    at Immediate.taskComplete (/Users/josh/src/project/node_modules/sails/node_modules/async/lib/async.js:440:13)
    at processImmediate [as _immediateCallback] (timers.js:368:17)
@jbcpollak jbcpollak changed the title Add Grunt tasks to integrate with Sails lift How to migrate when running sails lift? Dec 11, 2015
@RWOverdijk
Copy link
Collaborator

@jbcpollak This might have to do with sails being initialized again. There's a PR for it: #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants