pub async fn create_tables() -> Result<(), MigrateError>Expand description
Create a table for every registered model, deriving the schema from the models themselves.
A thin alias for umbral::migrate::create_tables_for_tests, which is where
the implementation lives — the migration engine already knows how to turn a
ModelMeta into DDL, and umbral-core’s own test suite needs the same helper
without a dev-dependency cycle back through this crate.
This is the one that stops your tests lying to you. The alternative is a
hand-written CREATE TABLE in the test file: a second source of truth for
the schema, which drifts the moment a model grows a column. The ORM then
queries a column that isn’t there, and any error-swallowing on the path (an
unwrap_or(false)) turns that into a test that PASSES WITH THE WRONG ANSWER.
umbral::App::builder()
.settings(settings)
.database("default", pool.clone_handle())
.model::<Note>()
.build()?;
umbral_testing::create_tables().await?; // schema == your models. always.Idempotent, and works on both backends. Most tests want boot, which calls
this for you.