Flexibility around using sqlx-cli to support multi-tenant databases. #4035
samueljoli
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my current setup, I use a Cargo workspace to implement Domain-Driven Design. Each bounded context is its own crate, and I follow the ports-and-adapters pattern with a dedicated infrastructure crate that owns cross-cutting concerns, including database migrations.
This design means migrations are not colocated with their bounded context crates. While sqlx-cli provides configuration options per crate, sqlx-toml assumes one crate manages one database. That assumption doesn’t hold when an infrastructure crate is responsible for managing multiple database tenants.
The question then becomes: should I invest in building a custom migration workflow, or is there an established workaround that better fits this architecture? I’m interested in hearing how others have approached this scenario.
Beta Was this translation helpful? Give feedback.
All reactions