parent
709099dd21
commit
d7955e5d0f
7 changed files with 74 additions and 35 deletions
@ -1,8 +0,0 @@ |
||||
{ |
||||
"host" : "localhost", |
||||
"user" : "root", |
||||
"port" : 8654, |
||||
"password" : "ert456", |
||||
"database" : "safechat", |
||||
"max_allowed_packet": 1000000000 |
||||
} |
@ -1,13 +1,11 @@ |
||||
module.exports = function() { |
||||
module.exports = function(config) { |
||||
var mysql = require('mysql'); |
||||
var fs = require('fs'); |
||||
var config = require(__dirname+'/config.json'); |
||||
config.multipleStatements = true; |
||||
var pool = mysql.createPool(config); |
||||
|
||||
console.log(__dirname+'/schema.sql') |
||||
pool.query(fs.readFileSync(__dirname+'/schema.sql').toString()); |
||||
if (config.max_allowed_packet) |
||||
pool.query("set global max_allowed_packet=?", [config.max_allowed_packet]); |
||||
|
||||
return pool; |
||||
}; |
||||
|
@ -0,0 +1,10 @@ |
||||
{ |
||||
"mysql": { |
||||
"host" : "localhost", |
||||
"user" : "root", |
||||
"port" : 8654, |
||||
"password" : "ert456", |
||||
"database" : "safechat", |
||||
"max_allowed_packet": 1000000000 |
||||
} |
||||
} |
Loading…
Reference in new issue