chore: undo $ prepend on queries
This commit is contained in:
parent
f3f2bb01b0
commit
ba4117173e
50 changed files with 215 additions and 227 deletions
|
|
@ -25,11 +25,11 @@ function saveAccounts (accounts) {
|
|||
return loadAccounts()
|
||||
.then(currentAccounts => {
|
||||
const newAccounts = _.merge(currentAccounts, accounts)
|
||||
return db.$none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
})
|
||||
}
|
||||
function resetAccounts (schemaVersion) {
|
||||
return db.$none(
|
||||
return db.none(
|
||||
accountsSql,
|
||||
[
|
||||
'accounts',
|
||||
|
|
@ -49,7 +49,7 @@ function loadAccounts (schemaVersion) {
|
|||
order by id desc
|
||||
limit 1`
|
||||
|
||||
return db.$oneOrNone(sql, ['accounts', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.oneOrNone(sql, ['accounts', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(_.compose(_.defaultTo({}), _.get('data.accounts')))
|
||||
}
|
||||
|
||||
|
|
@ -70,12 +70,12 @@ function saveConfig (config) {
|
|||
return loadLatestConfigOrNone()
|
||||
.then(currentConfig => {
|
||||
const newConfig = _.assign(currentConfig, config)
|
||||
return db.$none(configSql, ['config', { config: newConfig }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.none(configSql, ['config', { config: newConfig }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
})
|
||||
}
|
||||
|
||||
function resetConfig (schemaVersion) {
|
||||
return db.$none(
|
||||
return db.none(
|
||||
configSql,
|
||||
[
|
||||
'config',
|
||||
|
|
@ -103,7 +103,7 @@ function loadLatestConfig () {
|
|||
order by id desc
|
||||
limit 1`
|
||||
|
||||
return db.$one(sql, ['config', NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.one(sql, ['config', NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(row => row ? row.data.config : {})
|
||||
.catch(err => {
|
||||
throw err
|
||||
|
|
@ -118,7 +118,7 @@ function loadLatestConfigOrNone (schemaVersion) {
|
|||
order by id desc
|
||||
limit 1`
|
||||
|
||||
return db.$oneOrNone(sql, ['config', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.oneOrNone(sql, ['config', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(row => row ? row.data.config : {})
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ function loadConfig (versionId) {
|
|||
and schema_version=$3
|
||||
and valid`
|
||||
|
||||
return db.$one(sql, [versionId, 'config', NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
return db.one(sql, [versionId, 'config', NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(row => row.data.config)
|
||||
.catch(err => {
|
||||
if (err.name === 'QueryResultError') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue