16 lines
412 B
Rust
16 lines
412 B
Rust
use std::error::Error;
|
|
|
|
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
|
|
|
use crate::DbPool;
|
|
pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("./migrations");
|
|
|
|
|
|
pub fn run_migrations(pool: &DbPool) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
|
|
|
let connection = &mut pool.get().unwrap();
|
|
connection.run_pending_migrations(MIGRATIONS)?;
|
|
|
|
Ok(())
|
|
}
|