diff --git a/common/sequelize.js b/common/sequelize.js index 4807bbd92..29f38196d 100644 --- a/common/sequelize.js +++ b/common/sequelize.js @@ -1,19 +1,5 @@ -/**! - * cnpmjs.org - common/sequelize.js - * - * Copyright(c) fengmk2 and other contributors. - * MIT Licensed - * - * Authors: - * fengmk2 (http://fengmk2.github.com) - */ - 'use strict'; -/** - * Module dependencies. - */ - var Sequelize = require('sequelize'); var DataTypes = require('sequelize/lib/data-types'); var config = require('../config'); @@ -35,6 +21,7 @@ if (config.mysqlServers && config.database.dialect === 'sqlite') { console.warn('[WARNNING] your config.js was too old, please @see https://github.com/cnpm/cnpmjs.org/wiki/Migrating-from-1.x-to-2.x'); var server = config.mysqlServers[0]; + var dialectOptions = config.database && config.database.dialectOptions; config.database = { db: config.mysqlDatabase, username: server.user, @@ -45,10 +32,13 @@ if (config.mysqlServers && config.database.dialect === 'sqlite') { pool: { maxConnections: config.mysqlMaxConnections || 10, minConnections: 0, - maxIdleTime: 30000 + maxIdleTime: 30000, }, logging: !!process.env.SQL_DEBUG, }; + if (dialectOptions) { + config.database.dialectOptions = dialectOptions; + } } var database = config.database; diff --git a/config/index.js b/config/index.js index 655317d4f..735ef934e 100644 --- a/config/index.js +++ b/config/index.js @@ -121,6 +121,11 @@ var config = { maxIdleTime: 30000 }, + dialectOptions: { + // if your server run on full cpu load, please set trace to false + trace: true, + }, + // the storage engine for 'sqlite' // default store into ~/.cnpmjs.org/data.sqlite storage: path.join(dataDir, 'data.sqlite'),