digi-dump
v1.0.3
Published
Create a DUMP from MySQL
Downloads
5
Maintainers
Readme
Mysql Dump
Create a backup from MySQL / Maridb with configuration
Installation
npm install digi-dump
Example
var digiDump = require('digi-dump');
digiDump({
host: 'localhost',
user: 'root',
password: '',
database: 'test',
dest:'./****.sql' // destination file
},function(err){
// create data.sql file;
})
Full Options Example :
var digiDump = require('digiDump');
digiDump({
host: 'localhost',
user: 'root',
password: '',
database: 'test',
tables:['cars'], // include only these tables
where: {'cars': 'colors = `red`'},
ifNotExist:true, // Create a table if not exist
dest:'./****.sql' // destination file,
colsToIgnore: [] // name of the columns to ignore.. (globally from the table)
},function(err){
// create data.sql file;
})
Options
host
Type: String
Url to Mysql host. Default: localhost
port
Type: String
Port to Mysql host. Default: 3306
user
Type: String
The MySQL user to authenticate as.
password
Type: String
The password of that MySQL user
database
Type: String
Name of the database to dump.
tables
Type: Array
Array of tables that you want to backup.
Leave Blank for All. Default: [] ALL
schema
Type: Boolean
Output table structure Default: true
;
data
Type: Boolean
Output table data for ALL tables Default: true
;
where
Type: Object
Where clauses to limit dumped data Example: where: {'users': 'id < 1000'}
Combine with data: false
to only dump tables with where clauses Default: null
;
ifNotExist
Type: Boolean
Create tables if not exist method Default: true
;
dropTable
Type: Boolean
Drop tables if exist Default: false
;
getDump
Type: Boolean
Return dump as a raw data on callback instead of create file Default: false
;
dest
Type: String
Output filename with directories Default: './data.sql'
;
socketPath
Type: String