When using a microservice architecture, it would be convenient to use migrations on a single database from several crates.
// in crate foo
fn migrate(...) {
sqlx::migrate!(namespace = "foo")
}
// in crate bar
fn migrate(...) {
sqlx::migrate!("db/migrations", namespace = "bar")
}
// somewhere among the tests
fn foo_bar() -> Pool {
let pool = create_sqlx_pool();
foo::migrate(pool);
bar::migrate(pool);
pool
}
This would be useful not only in microservices but also in modular monoliths. foo and bar could be independent modules that happened to work in the same app, using the same database.
When using a microservice architecture, it would be convenient to use migrations on a single database from several crates.