Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //esto es el model, la ruta y el controlador es igual que siempre
- var mysqlDump = require('mysqldump');
- exports.dump = function(fn){
- mysqlDump({
- host: 'localhost',
- user: 'root',
- password: '',
- database: 'DataBase_name',
- tables:['table_name'], // only these tables
- // getDump: false,//BOOLEAN Return dump as a raw data on callback instead of create file Default: false;
- // where: {'players': 'id < 1000'}, // Only test players with id < 1000
- dest:'./mysqlDumps/chBack.sql' // OJO: CREAR DIRECTORIO MYSQLDUMPS DENTRO DE BACKEND EN DIRECTORIO EXPRESSJS, destination file
- },function(err){
- if (err) fn (err);
- else{
- console.log("desde models todo ok");
- fn({codigo: 1, mensaje: "dump correcto"});
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement