fix: add default timezone migration

This commit is contained in:
Sérgio Salgado 2022-02-21 16:13:30 +00:00
parent 3c33695b9d
commit fe879d45fc
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 }