Extract Database Modules (for Phoenix App.) into Their Own Library?

I’m not 100% sure I get everything you’re after—are you saying the schemas would also live in the library? If so, off the top of my head I would:

a) I would create a custom mix task in the library that will generate the appropriate migrations into your app.
b) Add a config option to your library to set the Repo it uses: config :my_library, :repo, MyApp.Repo.

In terms of keeping schemas in a library, I could see you running into problems where you’d want associations from your app on the schemas in your library, maybe. You could possibly run into some other issues too :thinking: But anyway, this is one way to do it!