asyncmigrate

Crates.ioasyncmigrate
lib.rsasyncmigrate
version0.2.0
sourcesrc
created_at2020-08-17 14:10:55.844663
updated_at2022-06-25 04:56:50.371243
descriptiondatabase migration with async support
homepagehttps://github.com/informationsea/asyncmigrate-rs
repositoryhttps://github.com/informationsea/asyncmigrate-rs
max_upload_size
id277513
size32,223
Yasunobu Okamura (informationsea)

documentation

README

asyncmigrate

database migration with async support

Supported database

  • PostgreSQL

License

Apache License 2.0

SQL file name rule

Name of SQL files must be follow a rule in below.

VERSION__NAME.sql

VERSION must be a simple number and not include dot.

Example

use asyncmigrate::{MigrationError, Migration};
use rust_embed::RustEmbed;
 
#[derive(RustEmbed)]
#[folder = "schema/"]
struct Assets;
 
let mut connection = asyncmigrate::connect(
    "postgres://dbmigration-test:dbmigration-test@127.0.0.1:5432/dbmigration-test",
)
.await?;
 
let changeset = asyncmigrate::MigrationChangeSets::load_asset("default", Assets)?;

// Run migration
connection.migrate(&changeset, None).await?;
 
// Rollback
connection.rollback("default", None).await?;
Commit count: 5

cargo fmt