rustyroad 1.2.0

Rusty Road is a framework written in Rust that is based on Ruby on Rails. It is designed to provide the familiar conventions and ease of use of Ruby on Rails, while also taking advantage of the performance and efficiency of Rust.
Documentation
use super::error::MigrationValidationError;
use super::guard;
use super::identity::Identity;
use sqlx::MySqlPool;

pub(super) async fn database(
    pool: &MySqlPool,
    id: &Identity,
) -> Result<(), MigrationValidationError> {
    guard::database(&id.database)?;
    sqlx::query(&format!("DROP DATABASE `{}`", id.database))
        .execute(pool)
        .await
        .map(|_| ())
        .map_err(|error| {
            MigrationValidationError::new(format!(
                "Could not remove isolated MySQL validation database '{}': {error}",
                id.database
            ))
        })
}

pub(super) async fn user(pool: &MySqlPool, id: &Identity) -> Result<(), MigrationValidationError> {
    guard::user(&id.user)?;
    sqlx::query(&format!("DROP USER '{}'@'%'", id.user))
        .execute(pool)
        .await
        .map(|_| ())
        .map_err(|error| {
            MigrationValidationError::new(format!(
                "Could not remove scoped MySQL validation user '{}': {error}",
                id.user
            ))
        })
}