AppReports/seeds/fake.js

24 lines
484 B
JavaScript
Raw Normal View History

2020-07-29 20:56:03 +02:00
'use strict';
const faker = require ('faker');
function create_log () {
return {
app: faker.random.word (),
message: faker.random.words (),
data: faker.random.objectElement (),
timestamp: faker.date.recent ()
};
}
async function seed (knex) {
console.log ('creating seeds');
for (let i = 0; i < 100; i++) {
// eslint-disable-next-line no-await-in-loop
await knex ('log')
.insert (create_log ());
}
}
module.exports = { seed };