trailsjs / sails-permissions

Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
MIT License
418 stars 113 forks source link

Mysql DB connection error #247

Closed saravanannnallasamy closed 7 years ago

saravanannnallasamy commented 7 years ago

I have created a new sails project and installed sails-permission. First it worked fine. After creating connection to Mysql and did sails lift it throws an error as

error: Error: Consistency violation: A model (passport) references a datastore which cannot be found ('mysql'). If this model definition has an explicit connection property, check that it is spelled correctly. If not, check your default connection (usually located in config/models.js).

The Model passport.js is located in node_modules/sails-permission/api/models.

config/connections.js

 mysql: {
    module    : 'sails-mysql',
    host      : '127.0.0.1',
    port      :  3306,
    user      : 'review',
    password  : 'review',
    database  : 'reviews'
  },

config/models.js

module.exports.models = {
  connection: 'mysql',
  migrate: 'alter'
};
saravanannnallasamy commented 7 years ago

It beacause of sails-mysql update. https://github.com/balderdashy/sails-mysql/pull/328/files Change module as adapter in

config/connection.js

mysql: {
    adapter    : 'sails-mysql',
    host      : '127.0.0.1',
    port      :  3306,
    user      : 'review',
    password  : 'review',
    database  : 'reviews'
  },