15 lines
409 B
Rust
15 lines
409 B
Rust
use sqlx::migrate::MigrateError;
|
|
use sqlx::{Pool, Sqlite};
|
|
|
|
pub async fn run_migrations(pool: &Pool<Sqlite>) -> Result<(), MigrateError> {
|
|
match sqlx::migrate!("../database/migrations").run(pool).await {
|
|
Ok(ok) => {
|
|
println!("Migrations are OK");
|
|
Ok(ok)
|
|
}
|
|
Err(e) => {
|
|
eprintln!("Failed to run migrations!");
|
|
Err(e)
|
|
}
|
|
}
|
|
}
|