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

Sequelize CLI support #41

Open
mrded opened this issue Oct 20, 2017 · 1 comment
Open

Sequelize CLI support #41

mrded opened this issue Oct 20, 2017 · 1 comment

Comments

@mrded
Copy link
Contributor

mrded commented Oct 20, 2017

I'm trying to use Sequelize CLI with sails, and then I run sequelize db:drop - it gives me an error:

Sequelize CLI [Node: 8.7.0, CLI: 3.0.0, ORM: 4.13.6]

WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support

Loaded configuration file "config/sequelize.js".

ERROR: Dialect undefined does not support db:create / db:drop commands

It happens because it doesn't understand that my database settings are defended in config/datastores.js and config/env/*.js files, under sails.config.connections || sails.config.datastores variables.

Sails itself does understand it, thanks to sails-hook-sequelize, but sequelize-cli doesn't.

I can solve that problem with following hack in config/sequelize.js:

var path = require('path');

var config = require(path.resolve('config/env', process.env.NODE_ENV || 'development')); 

var datastore = config.datastores.default;

module.exports = Object.assign(datastore, { charset: 'utf8' }); 

However I believe, it would be nice if sails-hook-sequelize supports sequelize-cli as well.

@jhnferraris
Copy link

@mrded Can you give me a full snapshot of how you did this? Thanks!

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