0
votes

I'm currently in the middle of upgrading our API from v0.12 of Sails to v1. Not the easiest task, but will be worth it.

The current problem I'm having, is converting our old "ModelName.query" calls to the new style, which is supposedly "sails.getDatastore". Great, fine.

Except, that when trying to do this in config/bootstrap.js, I constantly get the error "sails.getDatastore is not a function".

Yes, I am using the default sails-hook-orm, the .sailsrc has it turned on explicitly; and yes, I have globals turned on.

Is the problem that the function isn't registered until after bootstrap? Because that is not an option for us; bootstrap is validating our database schema before lift (custom code, using native queries), so our production servers fail to deploy if we missed a database update. It eliminates a ton of human error.

1

1 Answers

1
votes

Thanks for taking the 1.0 plunge!

I'm not sure what you mean by the "default" sails-hook-orm -- that hook is installed directly as a dependency on each Sails 1.0 project -- but I can almost guarantee that the version you're using is not correct. I would do:

npm cache clean
npm install sails-hook-orm@beta

in your project to make sure you get the latest (currently v2.0.0-21). It adds getDatastore to the app object when it initializes.