Hello
I’ve got the following setup and run into some problems when trying to test this:
So I’ve got a library “accounts” where I’ve got all my user/group/permission logic as well as the necessary migrations to create the tables, which is shared by some other actual apps. Currently this library uses it’s own Repo.
Next I’ve got a phoenix app that uses the “accounts” library (lets call it “master”), and more specifically the permission tables from that library. This app also has it’s own Repo, but the config for this Master.Repo and Accounts.Repo is shared, so in effect they both use the same DB.
The problem I’ve run into is when I’m trying to test this setup. I’m setting up my fixtures for the Master.Repo, including required users etc. However when creating a resource in the tests for the master app, that will call into the accounts app, which will try to grant some permissions on that resource. The last part of that operation will then fail, because using the sandbox mode of ecto the fixtures will only exist in the Master.Repo, but not in the Accounts.Repo, which is used by the “accounts” library.
Now I’ve got the following question: Is there either
a) Some way to get ecto to use the same sandbox for multiple repos? In that case I could simply keep this structure
or b) can I somehow configure the “accounts” library to use the repo from the “master” app, while keeping the migrations in the “accounts” library and not forcing the “master” app to write specific migrations?
Thanks already and have a good day