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:
parent
2cdc4b5d9a
commit
bdd8049e06
1 changed files with 65 additions and 0 deletions
|
@ -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
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue