mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
d2cb23c3fa
ref PROD-233 - Stored whether Docker is used in the config files - When running `yarn setup`, any existing Docker container will be reset. Run with `-y` to skip the confirmation step. - `yarn setup` will always init the database and generate fake data - Increased amount of default generated data to 100,000 members + 500 posts. - Made lots of performance improvements in the data generator so we can generate the default data in ±170s
29 lines
896 B
JavaScript
29 lines
896 B
JavaScript
const TableImporter = require('./TableImporter');
|
|
const {faker} = require('@faker-js/faker');
|
|
const {slugify} = require('@tryghost/string');
|
|
const {blogStartDate} = require('../utils/blog-info');
|
|
|
|
class BenefitsImporter extends TableImporter {
|
|
static table = 'benefits';
|
|
static dependencies = [];
|
|
defaultQuantity = 5;
|
|
|
|
constructor(knex, transaction) {
|
|
super(BenefitsImporter.table, knex, transaction);
|
|
}
|
|
|
|
generate() {
|
|
const name = faker.company.catchPhrase();
|
|
const sixMonthsLater = new Date(blogStartDate);
|
|
sixMonthsLater.setMonth(sixMonthsLater.getMonth() + 6);
|
|
return {
|
|
id: this.fastFakeObjectId(),
|
|
name: name,
|
|
slug: `${slugify(name)}-${faker.random.numeric(3)}`,
|
|
created_at: faker.date.between(blogStartDate, sixMonthsLater)
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = BenefitsImporter;
|