0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added migration to remove deprecated values from the settings table (#11942)

refs https://github.com/TryGhost/Ghost/issues/10318
refs https://github.com/TryGhost/Ghost/pull/11939

- Removes force_i18n, permalinks, and members_session_secret settings
values as their respective use has been removed from the codebase.
- Related code changes in referenced PR
This commit is contained in:
Naz 2020-06-23 19:07:33 +12:00 committed by GitHub
parent 2cdc4b5d9a
commit bdd8049e06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,65 @@
const ObjectId = require('bson-objectid');
const logging = require('../../../../../shared/logging');
module.exports = {
config: {
transaction: true
},
async up(options) {
const settingsKeys = ['force_i18n', 'permalinks', 'members_session_secret'];
logging.info(`Removing ${settingsKeys.join(',')} from "settings" table.`);
return await options
.transacting('settings')
.whereIn('key', settingsKeys)
.del();
},
async down(options) {
const currentTimestamp = options.transacting.raw('CURRENT_TIMESTAMP');
const forceI18nSetting = {
id: ObjectId.generate(),
key: 'force_i18n',
value: 'true',
type: 'blog',
created_at: currentTimestamp,
created_by: 1,
updated_at: currentTimestamp,
updated_by: 1
};
const permalinksSetting = {
id: ObjectId.generate(),
key: 'permalinks',
value: '/:slug/',
type: 'blog',
created_at: currentTimestamp,
created_by: 1,
updated_at: currentTimestamp,
updated_by: 1
};
const membersSessionSecretSetting = {
id: ObjectId.generate(),
key: 'members_session_secret',
value: null,
type: 'members',
created_at: currentTimestamp,
created_by: 1,
updated_at: currentTimestamp,
updated_by: 1
};
logging.info('Adding force_i18n, permalinks, and members_session_secret to "settings" table.');
return options.transacting('settings')
.insert([
forceI18nSetting,
permalinksSetting,
membersSessionSecretSetting
]);
}
};