Skip to content

Sequelize CLI support #41

@mrded

Description

@mrded

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions