mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
0bb81bb3c4
no issue - adapt major changes of knex-migrator v3 - adapt migration scripts, simplify and add `down` (rollback) hook if possible - clear Ghost cache after init hook (because of `knex-migrator migrate --init`) - ensure db migrations work with the CLI - updated troubleshooting guide (https://docs.ghost.org/v1/docs/troubleshooting#section-task-execute-is-not-a-function) **For development only: Please ensure you run `npm i -g knex-migrator@latest` to update your global installation to v3. We always prefer the local installation, but v3 has modified and added binaries.**
25 lines
828 B
JavaScript
25 lines
828 B
JavaScript
var Promise = require('bluebird'),
|
|
_ = require('lodash'),
|
|
fixtures = require('../../schema/fixtures'),
|
|
logging = require('../../../logging');
|
|
|
|
module.exports.config = {
|
|
transaction: true
|
|
};
|
|
|
|
module.exports.up = 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);
|
|
});
|
|
});
|
|
};
|