Ghost/core/server/data/migrations/init/2-create-fixtures.js
Katharina Irrgang 76b9a49eb8
🎨 Added Koenig Demo Post (#9747)
no issue

- add a new migration for 1.25 to insert the draft demo post for existing blogs
- ensure new blogs get the draft demo post as well
- tested on sqlite3 + mysql
- added handling if Ghost Author user doesn't exist anymore (fallback to owner user)
2018-07-24 14:37:17 +02:00

27 lines
869 B
JavaScript

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