node.js mysql-fixtures module.
npm install mysql-fixtures
var MySQLFixtures = require('mysql-fixtures');
var config = {
"host": "localhost",
"user": "root",
"password": "root",
"database": "sample"
};
var fixtures = MySQLFixtures.createFixtures(config);
fixtures.create('fixtures/data.yaml', function() {}
console.log('finish.');
));
user:
u1:
user_id : 1,
name : 'Taro',
age : 25
u2:
user_id : 2,
name : 'Jiro',
age : 19
item:
i1:
item_id : 10,
name : 'abcdef'
var MySQLFixtures = require('mysql-fixtures');
var config = {
"host": "localhost",
"user": "root",
"password": "root",
"database": "sample"
};
var helper = MySQLFixtures.createHelper(config);
helper.assert('select * from user order user_id', 'result/data.yaml', function() {}
console.log('finish.');
));
u1:
user_id : 1,
name : 'Taro',
age : 25
u2:
user_id : 2,
name : 'Jiro',
age : 19
- ver.0.1.1 Init.
- ver.0.1.2 Add Helper.