PostgreSQL

对于 PostgreSQL,需要两个库,pg@^7.0.0pg-hstore. 你只需要定义方言:

  1. const sequelize = new Sequelize('database', 'username', 'password', {
  2. // postgres!
  3. dialect: 'postgres'
  4. })

要通过 unix 域套接字进行连接,请在 host 选项中指定套接字目录的路径.

套接字路径必须以 / 开头.

  1. const sequelize = new Sequelize('database', 'username', 'password', {
  2. // postgres!
  3. dialect: 'postgres',
  4. host: '/path/to/socket_directory'
  5. })