(&self)
| 98 | } |
| 99 | |
| 100 | async fn run_migrations(&self) -> Result<(), DatabaseError> { |
| 101 | info!("Running database migrations"); |
| 102 | |
| 103 | for migration in crate::schema::ALL_MIGRATIONS { |
| 104 | sqlx::query(migration) |
| 105 | .execute(&self.pool) |
| 106 | .await |
| 107 | .map_err(|e| DatabaseError::MigrationError(e.to_string()))?; |
| 108 | } |
| 109 | |
| 110 | Ok(()) |
| 111 | } |
| 112 | |
| 113 | fn get_database_path() -> Result<PathBuf, DatabaseError> { |
| 114 | let data_dir = dirs::data_local_dir() |