fix: add default timezone migration
This commit is contained in:
parent
3c33695b9d
commit
fe879d45fc
2 changed files with 23 additions and 1 deletions
20
migrations/1645459054117-default-timezone.js
Normal file
20
migrations/1645459054117-default-timezone.js
Normal 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()
|
||||||
|
}
|
||||||
|
|
@ -143,4 +143,6 @@ const buildTzLabels = timezoneList => {
|
||||||
|
|
||||||
const labels = buildTzLabels(timezones)
|
const labels = buildTzLabels(timezones)
|
||||||
|
|
||||||
export { labels, timezones }
|
const DEFAULT_TIMEZONE = 'GMT'
|
||||||
|
|
||||||
|
export { labels, timezones, DEFAULT_TIMEZONE }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue