心澄欲遣

不践迹,亦不入于室

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

配置文件

development: {
    username: process.env.LOCAL_USERNAME,
    password: process.env.LOCAL_PASSWORD,
    database: process.env.LOCAL_DATABASE,
    //数据库ip地址
    host: '127.0.0.1',
    dialect: 'mssql',
    dialectOptions: {
      //数据库实例名称,没有则不用设置
      instanceName: 'SQLEXPRESS'
    },
    //定义表名的前缀,不设置此属性,则没有前缀
    define: {
      schema: "core"
    },
    port: '1433',
  }

实例化数据库

var config = require('../config');
const Sequelize = require('sequelize');

const sequelize = new Sequelize(config.database, config.username, config.password, {
  host: config.host,
  dialect: 'mssql',
  dialectOptions: {
    instanceName: 'SQLEXPRESS'
  },
  // define: {
  //   schema: "core"
  // },
  pool: {
    max: 5,
    min: 0,
    idle: 10000
  },
  timezone: '+08:00' //东八时区,不设置时区,时间不正确
});
module.exports = sequelize

 

posted on 2017-12-18 15:40  心澄欲遣  阅读(946)  评论(0编辑  收藏  举报
欢迎第myspace graphics个访客