Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(default-schema): allow addition of default schema through config #5480

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rohhamh
Copy link

@rohhamh rohhamh commented Feb 8, 2023

I faced a situation in which I had to change all queries to target a specific schema and I found no way to do so without changing the huge amount of knex query codes or editting the library method itself by adding this:

const Knex = require('knex')({
  client,
  connection,
})

const QueryBuilder = require('knex/lib/query/builder')
Knex.client.constructor.prototype.queryBuilder = () =>
  (new QueryBuilder(Knex.client)).withSchema('mySchema')

However, I think allowing the schema to be set from the very inital configuration like below can be of help to a few others like me.

const Knex = require('knex')({
  client,
  connection,
  schema: 'mySchema'
})

@siakc
Copy link

siakc commented Aug 5, 2024

I had to use this patch in order to run some migrations on an Oracledb schema which had access to another schema. Please consider merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants