Ghost/core/server/data/migrations/init/2-create-fixtures.js
Aileen Nowak 0ce24b48bd Moved published_at creation to fixtures/utils (#8595)
no issue

- follow-up from #8573
- bove the hack that creates published_at values from the migration fn to our fixture util
2017-09-19 12:54:01 +02:00

22 lines
773 B
JavaScript

var Promise = require('bluebird'),
_ = require('lodash'),
fixtures = require('../../schema/fixtures'),
logging = require('../../../logging');
module.exports = function insertFixtures(options) {
var localOptions = _.merge({
context: {internal: true}
}, options);
return Promise.mapSeries(fixtures.models, function (model) {
logging.info('Model: ' + model.name);
return fixtures.utils.addFixturesForModel(model, localOptions);
}).then(function () {
return Promise.mapSeries(fixtures.relations, function (relation) {
logging.info('Relation: ' + relation.from.model + ' to ' + relation.to.model);
return fixtures.utils.addFixturesForRelation(relation, localOptions);
});
});
};