Crate asyncmigrate

Source
Expand description

database migration with async support

§Supported database

  • PostgreSQL

§License

Apache License 2.0

§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?;

Modules§

tokio_postgres

Structs§

ChangeSet
a change set with upgrade SQL and downgrade SQL
ChangeSetVersionName
A change set version and a name
MigrationChangeSets
change sets for migration

Enums§

Connection
Connection.
MigrationError

Traits§

Migration

Functions§

connect
Connect to a database with database URL