mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
- use async/await and fat arrow syntax - makes it easier to refactor later as "this" context is then reliable
26 lines
805 B
JavaScript
26 lines
805 B
JavaScript
const Promise = require('bluebird');
|
|
const _ = require('lodash');
|
|
const fixtures = require('../../schema/fixtures');
|
|
const logging = require('@tryghost/logging');
|
|
|
|
module.exports.config = {
|
|
transaction: true
|
|
};
|
|
|
|
module.exports.up = async (options) => {
|
|
const localOptions = _.merge({
|
|
context: {internal: true},
|
|
migrating: true
|
|
}, options);
|
|
|
|
await Promise.mapSeries(fixtures.models, async (model) => {
|
|
logging.info('Model: ' + model.name);
|
|
|
|
await fixtures.utils.addFixturesForModel(model, localOptions);
|
|
});
|
|
|
|
await Promise.mapSeries(fixtures.relations, async (relation) => {
|
|
logging.info('Relation: ' + relation.from.model + ' to ' + relation.to.model);
|
|
await fixtures.utils.addFixturesForRelation(relation, localOptions);
|
|
});
|
|
};
|