0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Removed 2.16 member permission migration

no-issue

It turned out that due to the mismatch between `"members"` and
`"member"`, that not a single row was added to the database via this
migration. Clearing the file for simplicity.
This commit is contained in:
Fabien O'Carroll 2019-05-02 17:18:04 +02:00
parent c70f5a0567
commit a77190a312

View file

@ -1,43 +1 @@
const _ = require('lodash');
const utils = require('../../../schema/fixtures/utils');
const permissions = require('../../../../services/permissions');
const common = require('../../../../lib/common');
const resource = 'members';
const _private = {};
_private.getPermissions = function getPermissions() {
return utils.findModelFixtures('Permission', {object_type: resource});
};
_private.getRelations = function getRelations() {
return utils.findPermissionRelationsForObject(resource);
};
_private.printResult = function printResult(result, message) {
if (result.done === result.expected) {
common.logging.info(message);
} else {
common.logging.warn('(' + result.done + '/' + result.expected + ') ' + message);
}
};
module.exports.up = function addMembersPermissions(options) {
const modelToAdd = _private.getPermissions();
const relationToAdd = _private.getRelations();
const localOptions = _.merge({
context: {
internal: true,
migrating: true
}
}, options);
return utils.addFixturesForModel(modelToAdd, localOptions)
.then(function (result) {
_private.printResult(result, 'Adding permissions fixtures for ' + resource + 's');
return utils.addFixturesForRelation(relationToAdd, localOptions);
})
.then(function (result) {
_private.printResult(result, 'Adding permissions_roles fixtures for ' + resource + 's');
return permissions.init(localOptions);
});
};
module.exports.up = module.exports.down = () => Promise.resolve();