SQLite

由于 SQLite 兼容性,你需要sqlite3@^4.0.0. 像这样配置 Sequelize:

  1. const sequelize = new Sequelize('database', 'username', 'password', {
  2. // sqlite!
  3. dialect: 'sqlite',
  4. // sqlite 的存储引擎
  5. // - default ':memory:'
  6. storage: 'path/to/database.sqlite'
  7. })

或者你也可以使用连接字符串和路径:

  1. const sequelize = new Sequelize('sqlite:/home/abs/path/dbname.db')
  2. const sequelize = new Sequelize('sqlite:relativePath/dbname.db')