-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow to specify custom schema name #15
Comments
I think both suggestions are reasonable! I'm open to a PR if you want to tackle this, otherwise, I'm sure we can accommodate this relatively soon! |
Hi @mgibowski I've made a PR which implements both suggestions! I've written up some documentation and will push it out once tested and merged, but in short, you'll be able to do the following in future:
Thanks for raising and sorry for the delays ❤️ |
@mgibowski just pushed |
Amazing, thanks a lot! |
Current behaviour
Currently Endo hard-codes the schema name to "public":
endo/lib/endo/adapters/postgres/table.ex
Line 56 in 2b7b493
However, sometimes the application may use a schema with a different name.
Connection prefixes in Ecto
Ecto calls those are called "connection prefixes" and there are two ways to set them.
connection_prefix
With the help of the
after_connect
callback as documented in Ecto:https://hexdocs.pm/ecto_sql/Ecto.Adapters.Postgres.html#module-after-connect-callback
https://hexdocs.pm/ecto/multi-tenancy-with-query-prefixes.html#per-query-and-per-struct-prefixes
Example:
Suggestion
It would be great if Endo supported querying schemas other than "public".
One possibility would be allowing to configure a global table schema that would overwrite the default "public" with a config:
Or (and) to mimic the Ecto API, for example:
The text was updated successfully, but these errors were encountered: