MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / reset_db

Function reset_db

chirpstack/src/storage/mod.rs:238–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

236
237#[cfg(test)]
238pub async fn reset_db() -> Result<()> {
239 let c = get_async_db_conn().await?;
240 let mut c_wrapped: AsyncConnectionWrapper<AsyncDbPoolConnection> =
241 AsyncConnectionWrapper::from(c);
242
243 tokio::task::spawn_blocking(move || -> Result<()> {
244 c_wrapped
245 .revert_all_migrations(MIGRATIONS)
246 .map_err(|e| anyhow!("During revert: {}", e))?;
247 c_wrapped
248 .run_pending_migrations(MIGRATIONS)
249 .map_err(|e| anyhow!("During run: {}", e))?;
250
251 Ok(())
252 })
253 .await?
254}
255
256#[cfg(test)]
257pub async fn reset_redis() -> Result<()> {

Callers 1

prepareFunction · 0.85

Calls 1

get_async_db_connFunction · 0.70

Tested by 1

prepareFunction · 0.68