mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
0ce24b48bd
no issue - follow-up from #8573 - bove the hack that creates published_at values from the migration fn to our fixture util
22 lines
773 B
JavaScript
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);
|
|
});
|
|
});
|
|
};
|