Fixed typo in migration to add backupContent permission (#12777)

refs https://github.com/TryGhost/Team/issues/553

This was introduced in https://github.com/TryGhost/Ghost/commit/79c3709f

This migration has a `noop` for the down, as we never want to revert
Ghost to a broken state
This commit is contained in:
Fabien 'egg' O'Carroll 2021-03-18 14:52:12 +00:00 committed by GitHub
parent ba511445df
commit 8318391d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,6 @@ const {
module.exports = addPermission({
name: 'Backup database',
action: 'backupContect',
action: 'backupContent',
object: 'db'
});

View File

@ -0,0 +1,15 @@
const logging = require('../../../../../shared/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(async function up(knex) {
const typoedPermission = await knex.select('*').from('permissions').where('action_type', 'backupContect').first();
if (!typoedPermission) {
return logging.warn('Not updating permissions, no typo found');
}
logging.info('Updating permissions, fixing typo by renaming "backupContect" to "backupContent"');
await knex('permissions').update('action_type', 'backupContent').where('action_type', 'backupContect');
}, async function down() {
// noop
});