Skip to content

Commit

Permalink
Set schema option (#105)
Browse files Browse the repository at this point in the history
Added the `schema` service option and param operator
  • Loading branch information
EmileSpecs committed Jul 4, 2020
1 parent 369dd25 commit f1e8558
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class Service extends AdapterService {
this.createUseUpsertGraph = options.createUseUpsertGraph;
this.allowedUpsert = options.allowedUpsert && RelationExpression.create(options.allowedUpsert);
this.upsertGraphOptions = options.upsertGraphOptions;
this.schema = options.schema;
}

get Model () {
Expand Down Expand Up @@ -276,7 +277,10 @@ class Service extends AdapterService {

_createQuery (params = {}) {
const trx = params.transaction ? params.transaction.trx : null;
return this.Model.query(trx);
const schema = params.schema || this.schema;
let query = this.Model.query(trx);

return schema ? query.withSchema(schema) : query;
}

createQuery (params = {}) {
Expand Down

0 comments on commit f1e8558

Please sign in to comment.