Merge pull request #1123 from chaotixkilla/fix-add-default-timezone-migration

Default timezone migration
This commit is contained in:
Rafael Taranto 2022-02-24 20:47:38 +00:00 committed by GitHub
commit 156e20f95b
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,20 @@
const _ = require('lodash/fp')
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
exports.up = function (next) {
const newConfig = {}
return loadLatest()
.then(config => {
if (!_.isNil(config.config.locale_timezone)) return
newConfig[`locale_timezone`] = 'GMT'
return saveConfig(newConfig)
})
.then(next)
.catch(err => {
return next(err)
})
}
module.exports.down = function (next) {
next()
}

View file

@ -143,4 +143,6 @@ const buildTzLabels = timezoneList => {
const labels = buildTzLabels(timezones)
export { labels, timezones }
const DEFAULT_TIMEZONE = 'GMT'
export { labels, timezones, DEFAULT_TIMEZONE }