I have a project in heroku. I have the URI that enables me to connect with the database in my external rails app. How do I change or set the search path in ruby code?
Asked
Active
Viewed 4,934 times
2 Answers
1
You can define it in your database.yml using the schema_search_path key with a string value
production:
adapter: postgresql
...
schema_search_path: 'schema1,public'
You can find out a bit more here: https://til.hashrocket.com/posts/5aa2892b43-set-schema-search-path
Jose Rafael Santiago Jr.
- 126
- 2
0
For the session, when inside/connected with psql, you can use SETsearch_path =. Or you can use the GUC and change the default for the user or database which will impact all connections from the user or to the specified database.
ALTER ROLE myUsername SET search_path = ...ALTER DATABASE myDatabase SET search_path = ...
Evan Carroll
- 65,432
- 50
- 254
- 507