fix: save config used on migration
This commit is contained in:
parent
c072803ac3
commit
bd2d2b06c2
12 changed files with 31 additions and 19 deletions
|
|
@ -82,6 +82,17 @@ function saveConfig (config) {
|
|||
})
|
||||
}
|
||||
|
||||
function migrationSaveConfig (config) {
|
||||
return loadLatestConfigOrNone()
|
||||
.then(currentConfig => {
|
||||
const newConfig = _.assign(currentConfig, config)
|
||||
return db.tx(t => {
|
||||
return t.none(configSql, ['config', { config: newConfig }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(() => t.none('NOTIFY $1:name, $2', ['poller', JSON.stringify({ type: 'reload', schema: asyncLocalStorage.getStore().get('schema') })]))
|
||||
}).catch(console.error)
|
||||
})
|
||||
}
|
||||
|
||||
function resetConfig (schemaVersion) {
|
||||
return db.none(
|
||||
configSql,
|
||||
|
|
@ -172,6 +183,7 @@ function migrate () {
|
|||
|
||||
module.exports = {
|
||||
saveConfig,
|
||||
migrationSaveConfig,
|
||||
resetConfig,
|
||||
saveAccounts,
|
||||
resetAccounts,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue