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.
//! Shared fixture for versioned schema tests.
usecrate::database::versions::history;usecrate::database::DatabaseConnection;usestd::sync::Arc;/// Builds an in-memory SQLite connection with the history table created.
pub(super) async fnsqlite()-> DatabaseConnection{let pool =sqlx::SqlitePool::connect("sqlite::memory:").await
.expect("failed to open in-memory sqlite database");let connection =DatabaseConnection::Sqlite(Arc::new(pool));history::ensure_table(&connection).await
.expect("failed to create history table");
connection
}/// Counts rows in the history table.
pub(super) async fnhistory_rows(connection:&DatabaseConnection)->i64{letDatabaseConnection::Sqlite(pool)= connection else{panic!("expected sqlite connection");};sqlx::query_scalar("SELECT COUNT(*) FROM _rustyroad_history").fetch_one(pool.as_ref()).await
.expect("failed to count history rows")}