I am writing an application with Knex, Bookshelf, and Postgres. I would like all Postgres commands issued from my application to be on tables in one schema. Is there a way I can accomplish this without specifying .withSchema('my_schema_name')
for each individual query/command?
Ideally, I could specify the schema in the knexfile.js, but I don't see a way to do this.
I have already tried:
Both of these resulted in various errors.
The solution was actually to pretend the tableName with 'my_schema.'. (Notice the dot)
The error I had seen when I tried this initially was due to something else.
Your connection should call SET search_path TO my_schema, public;
after being initialized. This is a connection (session) property and it should do what you are asking for.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.