mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 13:20:59 +00:00
add new example for migration
This commit is contained in:
parent
f5ae543128
commit
e9e0f6d77b
@ -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>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user