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