rustyroad 1.7.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::model::MigrationFile;
use std::fs;

pub(super) fn read(migration: &MigrationFile) -> Result<String, MigrationValidationError> {
    fs::read_to_string(&migration.up_sql_path).map_err(|error| {
        MigrationValidationError::new(format!(
            "Could not read migration '{}' from '{}': {error}",
            migration.name,
            migration.up_sql_path.display()
        ))
    })
}

pub(super) fn execution_error(
    migration: &MigrationFile,
    database: &str,
    error: sqlx::Error,
) -> MigrationValidationError {
    MigrationValidationError::new(format!(
        "Migration '{}' failed against the isolated {database} validation database: {error}",
        migration.name
    ))
}