UNPKG

@mikro-orm/seeder

Version:

Seeder package for MikroORM.

12 lines (11 loc) 398 B
/** Base class for database seeders. Extend this class and implement `run()` to populate the database with data. */ export class Seeder { async call(em, seeders, context = {}) { for (const Seeder of seeders) { const fork = em.fork(); const instance = new Seeder(); await instance.run(fork, context); await fork.flush(); } } }