Function generate

Source
pub async fn generate<P: AsRef<Path>, Q: AsRef<Path>>(
    connection_url: Option<&str>,
    migrations_path: P,
    destination_path: Q,
) -> Result<(), Error>
Expand description

Generate a destination_path SQL file using migrations from the migrations_path folder.

Calling this function is strictly equivalent to:

// This assumes you're using SQLite in memory.
//
// If you need to set up a `connection_url` you can use `DatabaseSchemaBuilder::connection_url`
// before calling `build()`.

DatabaseSchemaBuilder::new()
    .migrations_dir(migrations_path)?
    .destination_path(destination_path)
    .build()
    .dump()
    .await

Requires an executor to be available.