pub async fn init(db: &DB) -> Result<(), Box<dyn Error>>Expand description
Initializes the database schema by executing the initial schema script. This function reads the schema from a file and executes it against the provided database connection.
§Arguments
db- A reference to the database connection.
§Returns
Ok(())if the schema was initialized successfully.Err(Box<dyn Error>)if there was an error during initialization.
§Example
use crate::db::schema;
async fn setup_database(db: &crate::db::DB) -> Result<(), Box<dyn Error>> {
schema::init(db).await?;
Ok(())
}