cli: Unable to resolve storage 'sequelize' [on Win7 64-bit]

Hi,

I am using sequelize-cli to migrate new changes to my running solution. Basically, creating a workflow for pushing updates to my MySQL server hosting my test db. I have one migration file named 20141218140725-create-cafe-owner.js created using the CLI’s migration:create command. I used the db:migrate command and it borked giving me this error:

D:\WampDeveloper\Websites\www.example.com\webroot\api_dev>sequelize db:migrate

Sequelize [Node: 0.10.21, CLI: 1.0.0, ORM: 2.0.0-dev9]

Loaded configuration file 'config\config.json'.
[17:24:19] Using sequelizefile ~\AppData\Roaming\npm\node_modules\sequelize-cli\lib\sequelizefile.js
[17:24:19] Starting 'db:migrate'...
[17:24:19] 'db:migrate' errored after 51 ms Unable to resolve the storage: sequelize

D:\WampDeveloper\Websites\www.example.com\webroot\api_dev>

Here’s my migration file migrations/20141218140725-create-cafe-owner.js :

"use strict";
module.exports = {
  up: function(migration, DataTypes, done) {
    migration.createTable("CafeOwners", {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: DataTypes.INTEGER
      },
      email: {
        type: DataTypes.STRING(100)
      },
      password: {
        type: DataTypes.STRING(255)
      },
      lastLogin: {
        allowNull: true,
        type: DataTypes.DATE,
      },
      createdAt: {
        allowNull: false,
        type: DataTypes.DATE
      },
      updatedAt: {
        allowNull: false,
        type: DataTypes.DATE
      },
      deletedAt: {
        allowNull: true,
        type: DataTypes.DATE
      },
    }).done(done);
  },
  down: function(migration, DataTypes, done) {
    migration.dropTable("CafeOwners").done(done);
  }
};

For the sake of completeness, here’s my config/config.json file as well:

{
  "development": {
    "username": "dbuser",
    "password": "test123",
    "database": "sequelize_test",
    "host": "127.0.0.1",
    "dialect": "mysql"
  },
  "test": {
    "username": "eratest",
    "password": "eratest",
    "database": "sequelize_test",
    "host": "127.0.0.1",
    "dialect": "mysql"
  },
  "production": {
    "username": "ha61gc4e",
    "password": "317e7da87327b3f149b8da90fc1d5746",
    "database": "erasmus",
    "host": "127.0.0.1",
    "dialect": "mysql"
  }
}

I tried to dig through the source, but I am still learning production JS and it seems quite complicated to follow where it’s going wrong. After trying to look up this error on Google, I found something about the Sequelize_meta table, but could not find such a table in my database.

Can anyone guide me in the right direction to alleviate this problem?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 43 (24 by maintainers)

Commits related to this issue

Most upvoted comments

Can you tell me what the result of the following commands are looking like?

mkdir tmp
cd tmp
npm install sequelize-cli sequelize mysql
node_modules/.bin/sequelize init
# please edit the config/config.json accordingly
node_modules/.bin/sequelize db:migrate

@framled : That happened because sequelize-cli was using the wrong config.json, just make sure all paths in .sequelizerc point to the correct config file and sequelizer folders.

my .sequelizerc

const path = require('path');

module.exports = {
  "config": path.resolve('./config', 'config.json'),
  "models-path": path.resolve('./models'),
  "seeders-path": path.resolve('./seeders'),
  "migrations-path": path.resolve('./migrations')
};