diff --git a/README.md b/README.md index 8c6557a..420eb81 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,10 @@ __Options:__ Returns a KnexJS query with the [common filter criteria](https://docs.feathersjs.com/api/databases/querying.html) (without pagination) applied. -### params.knex - -When making a [service method](https://docs.feathersjs.com/api/services.html) call, `params` can contain an `knex` property which allows to modify the options used to run the KnexJS query. See [customizing the query](#customizing-the-query) for an example. +### Params Operators +When making a [service method](https://docs.feathersjs.com/api/services.html) call, `params` can contain: +- **`knex`** - Modifies the options used to run the KnexJS query. See [customizing the query](#customizing-the-query) for an example. +- **`schema`** - Database schema to use with the query (e.g. `public`) See [`withSchema`](http://knexjs.org/#Builder-withSchema) documentation. Overrides service's `schema` option. ## Example diff --git a/lib/index.js b/lib/index.js index 89cbc1e..f688836 100644 --- a/lib/index.js +++ b/lib/index.js @@ -64,7 +64,8 @@ class Service extends AdapterService { // NOTE (EK): We need this method so that we return a new query // instance each time, otherwise it will reuse the same query. db (params = {}) { - const { knex, table, schema, fullName } = this; + const { knex, table, fullName } = this; + const schema = params.schema || this.schema; if (params.transaction) { const { trx, id } = params.transaction; debug('ran %s with transaction %s', fullName, id);