@clarkieryan/typeormseed
v0.0.2
Published
Fixtures/Seeding for typeorm
Downloads
1
Readme
Typeorm Seeding
Factory.define(User, {
email : function(cb) { cb('user' + emailCounter++ + '@example.com'); },
state : 'activated',
password : '123456'
});
Factory.define(Post, {
user_id : Factory.assoc('user', 'id'),
subject : 'Hello World',
content : 'Lorem ipsum dolor sit amet...'
});
const factory = new Factory({ connectionName: "" });
// To create a user in the db
const user = async factory.create('user', { state: deactivated });
const users = async factory.create('user', { }, 20);