Comparing version 1.0.2 to 1.1.0
17
index.js
@@ -81,2 +81,3 @@ var async = require('async'); | ||
autoIncrement:true, | ||
getDump:false, | ||
dest:'./data.sql', | ||
@@ -91,2 +92,3 @@ } | ||
port:options.port, | ||
socketPath:options.socketPath, | ||
})); | ||
@@ -102,3 +104,4 @@ | ||
if(!options.tables || !options.tables.length){ // if not especifed, get all | ||
mysql.query("SHOW TABLES FROM "+options.database,function(err,data){ | ||
mysql.query("SHOW TABLES FROM `"+options.database+"`",function(err,data){ | ||
if(err) return callback(err); | ||
var resp = []; | ||
@@ -120,3 +123,3 @@ for(var i=0;i<data.length;i++) resp.push(data[i]['Tables_in_'+options.database]); | ||
run.push(function(callback){ | ||
mysql.query("SHOW CREATE TABLE "+table,callback); | ||
mysql.query("SHOW CREATE TABLE `"+table+"`",callback); | ||
}) | ||
@@ -143,3 +146,3 @@ }) | ||
run.push(function(callback){ | ||
mysql.select({cols:'*', from:table},function(err,data){ | ||
mysql.select({cols:'*', from:"`"+table+"`"},function(err,data){ | ||
callback(err,buildInsert(data,table)); | ||
@@ -151,12 +154,14 @@ }); | ||
}], | ||
createFile:['createSchemaDump','createDataDump',function(callback,results){ | ||
getDataDump:['createSchemaDump','createDataDump',function(callback,results){ | ||
if(!results.createSchemaDump || !results.createSchemaDump.length) results.createSchemaDump=[]; | ||
if(!results.createDataDump || !results.createDataDump.length) results.createDataDump=[]; | ||
fs.writeFile(options.dest, results.createSchemaDump.concat(results.createDataDump).join("\n\n"), callback); | ||
callback(null,results.createSchemaDump.concat(results.createDataDump).join("\n\n")); | ||
}] | ||
},function(err,results){ | ||
if(err) throw new Error(err); | ||
console.timeEnd('mysql dump'); | ||
done(err,results.createFile); | ||
if(options.getDump) return done(err, results.getDataDump); | ||
fs.writeFile(options.dest, results.getDataDump, done); | ||
}); | ||
} |
{ | ||
"name": "mysqldump", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Create a DUMP from MySQL", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -110,8 +110,14 @@ # Mysql Dump | ||
Output filname with directories `Default: './data.sql'`; | ||
Output filename with directories `Default: './data.sql'`; | ||
![npm](https://nodei.co/npm/mysqldump.png?downloads=true&downloadRank=true&stars=true) | ||
#### SocketPath | ||
Type: `String` | ||
Path to a unix domain socket to connect to. When used `host` and `port` are ignored. | ||
[![npm](https://nodei.co/npm/mysqldump.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/mysqldump) | ||
--------------------------------- | ||
The MIT [License](https://raw.githubusercontent.com/webcaetano/mysqldump/master/LICENSE.md) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147
123
8453
5