Cli: SQLite: --url and new Sequelize(url) have different behavor

Created on 24 Oct 2016  路  2Comments  路  Source: sequelize/cli

import Sequelize from 'sequelize'

new Sequelize('sqlite://a.db/hello')

It works. while

$ seqeulize --url sqlite://a.db/hello db:migrate

Got error

Unable to connect to database: SequelizeConnectionError: SQLITE_CANTOPEN: unable to open database file

For, it tries to open /hello file, and the config parsed by sequelize-cli is

{ database: 'hello,
  dialect: 'sqlite',
  host: 'a.db',
  port: null,
  storage: '/hello' }

The related code is located at https://github.com/sequelize/cli/blob/master/lib/helpers/config-helper.js#L176 and https://github.com/sequelize/sequelize/blob/master/lib/dialects/sqlite/connection-manager.js#L62

stale

All 2 comments

In my case, following works fine.
//config.js

module.exports = {
  "development": {
    "storage": "./server/dev_db.sqlite",
    "dialect": "sqlite"
  },
  "test": {
    "storage": "./server/test_db.sqlite",
    "dialect": "sqlite"
  },
  "production": {
    "storage": "./server/prod_db.sqlite",
    "dialect": "sqlite"
  }
}

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

axetroy picture axetroy  路  3Comments

LucasBadico picture LucasBadico  路  5Comments

PavelPolyakov picture PavelPolyakov  路  5Comments

przbadu picture przbadu  路  3Comments

OsoianMarcel picture OsoianMarcel  路  4Comments