Fix: wrong bind on db.taskEx
This commit is contained in:
parent
440b8e7f61
commit
178f2dafde
2 changed files with 3 additions and 5 deletions
|
|
@ -12,13 +12,11 @@ const pgp = Pgp({
|
||||||
obj.taskEx = function () {
|
obj.taskEx = function () {
|
||||||
const args = pgp.utils.taskArgs(arguments)
|
const args = pgp.utils.taskArgs(arguments)
|
||||||
const { schema } = args.options
|
const { schema } = args.options
|
||||||
if ('schema' in args.options) {
|
delete args.options.schema
|
||||||
delete args.options.schema
|
|
||||||
}
|
|
||||||
if (schema) {
|
if (schema) {
|
||||||
return obj.task.call(this, args.options, t => {
|
return obj.task.call(this, args.options, t => {
|
||||||
return t.none('SET search_path to $1:name', [schema])
|
return t.none('SET search_path to $1:name', [schema])
|
||||||
.then(args.cb.bind(this, t))
|
.then(args.cb.bind(t, t))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error('No schema selected, cannot complete query'))
|
return Promise.reject(new Error('No schema selected, cannot complete query'))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const getSchema = () => 'public'
|
const getSchema = () => 'public'
|
||||||
|
|
||||||
const getDefaultSchema = () => 'public2'
|
const getDefaultSchema = () => 'public'
|
||||||
|
|
||||||
const any = (obj, query, variables) => {
|
const any = (obj, query, variables) => {
|
||||||
const schema = getSchema()
|
const schema = getSchema()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue