db.rs 330 B

123456789101112131415
  1. use sqlx::sqlite::SqlitePool;
  2. pub async fn init(url: &str) -> SqlitePool {
  3. let pool = SqlitePool::connect(url)
  4. .await
  5. .expect("error while connecting to db");
  6. sqlx::migrate!()
  7. .run(&pool)
  8. .await
  9. .expect("error in migrations");
  10. log::info!("Connected to postgres");
  11. pool
  12. }