I have an application that is designed for multiple databases, it looks like an application that monitors applications that report, notify about alerts, run tasks and materials in such a way that it is impossible to control statically (in the configuration file), so I thought this could be done by starting a supervisor that controls several Repo by simply changing their settings in opts (I thought in the repository pool, something like this sounds crazy, I know), but this is not possible, since Ecto.Repo has macro with which binds the connection to the module Repo , so that there is a way to rewrite Ecto.Repo so that I could meet their needs? I looked at the sources of ecto, but I did not find a solution digging around alone.
I also looked at this post , but there is a chance that the application will target multiple instances, with different users, different credentials, etc.
I came up with some solutions using Code.eval to create Repos on the fly, but I donβt know how good it is and if it is encouraged.
elixir ecto
Wesley schleumer de gΓ³es
source share