refactor migration

This commit is contained in:
Josh Harvey 2017-07-19 16:14:45 +02:00
parent 272405b4b1
commit 916a3629a8
7 changed files with 84 additions and 58 deletions

View file

@ -135,6 +135,8 @@ function settings () {
function save (config) {
const sql = 'insert into user_config (type, data, valid) values ($1, $2, $3)'
console.log('DEBUG800: %s', sql)
return configValidate.validate(config)
.then(() => db.none(sql, ['config', {config}, true]))
.catch(() => db.none(sql, ['config', {config}, false]))