mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
21 lines
772 B
JavaScript
21 lines
772 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);
|
||
|
});
|
||
|
});
|
||
|
};
|