From e9e0f6d77bf979c5dd6217c8db3697ab1afb8518 Mon Sep 17 00:00:00 2001 From: Eric Semeniuc <3838856+esemeniuc@users.noreply.github.com> Date: Mon, 2 Nov 2020 05:12:57 -0800 Subject: [PATCH] add new example for migration --- sqlx-core/src/migrate/migrator.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sqlx-core/src/migrate/migrator.rs b/sqlx-core/src/migrate/migrator.rs index 36b38423..f69390c4 100644 --- a/sqlx-core/src/migrate/migrator.rs +++ b/sqlx-core/src/migrate/migrator.rs @@ -43,6 +43,18 @@ impl Migrator { /// Run any pending migrations against the database; and, validate previously applied migrations /// against the current migration source to detect accidental changes in previously-applied migrations. + /// + /// # Examples + /// + /// ```rust,no_run + /// # fn main() -> Result<(), sqlx_core::migrate::MigrateError> { + /// # sqlx_rt::block_on(async move { + /// let m = sqlx_core::migrate::Migrator::new(std::path::Path::new("./migrations")).await?; + /// let pool = sqlx_core::sqlite::SqlitePoolOptions::new().connect("sqlite::memory:").await?; + /// m.run(&pool).await + /// # }) + /// # } + /// ``` pub async fn run<'a, A>(&self, migrator: A) -> Result<(), MigrateError> where A: Acquire<'a>,