davemccrea
Multitenancy and Oban
Hi folks.
I have a web app running using foreign keys for multitenancy (see Multi tenancy with foreign keys).
Turns out Oban doesn’t play so nicely with this set up due to the prepare_query/3 function in the Repo module. I saw one issue related to this on Github (see Set flag in query options to detect oban query) but no solution.
I have managed to get Oban up and running by creating a second repo module with the same database configuration, except only for Oban.
Are there any drawbacks to using two repos in this way?
Marked As Solved
zachallaun
I encountered the exact same issue and chose a slightly different option. Instead of using a different repo, I chose to install Oban using its own table prefix, and then used that comparison to ignore the tenancy requirements in prepare_query:
unless opts[:prefix] == "private" do
…
end
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









