Open papel opened 1 year ago
@papel thanks for your feedback. Actually, there's a option for pg's schema, as following: Did you try it?
@an-tao, I tried adding it, but it isn't working. It says the relation doesn't exist and it is still using 'public'.
If I create a new project with drogon_ctl create project
, the file config.json in the main directory will not have schema, but the file models/config.json will.
I also tried to find "search_path" and "schema" with grep -r -H
in the source and I didn't find the place where it is handled.
You can currently specify the connection string using the newPgClient
method.
auto clientPtr = drogon::orm::DbClient::newPgClient("host=XXX port=XXX dbname=XXX user=XXX password=XXX options='-csearch_path=XXX'", 1);
I agree an implementation with the config file would be handy.
This PR #1972 adds supports for pg connection options, but is currently hanging because I cannot make a good abstraction for three db types.
I'm unable to choose the schema to use when connecting to the database. Currently I have to prepend the schema name before the table name in every query.
I also tried the following command and it didn't work.
clientPtr->execSqlSync("SET search_path = $1", "my_schema");
When creating a Postgres connection in other libraries, we usually use arguments like
options='-csearch_path=my_schema'
to specify the schema.It would be good if there were an option in config.json to choose the default schema. The parameter could be either
"schema": "my_schema"
or"rdbms_options": "-csearch_path=my_schema"