diff --git a/src/database/drop.sql b/src/database/drop.sql new file mode 100644 index 00000000..37167edc --- /dev/null +++ b/src/database/drop.sql @@ -0,0 +1,3 @@ +DROP TABLE IF EXISTS totp_challenge; +DROP TABLE IF EXISTS account; + diff --git a/src/database/mod.rs b/src/database/mod.rs index 841c10f0..6ae6b7be 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -77,6 +77,9 @@ macro_rules! database_configuration { let url = config.to_url($scheme); connection.init($driver {}, url.as_str())?; + #[cfg(test)] + connection.exec(include_str!("drop.sql"), vec![]).await?; + // perform migrations let last: Option = Migration::select_latest(&connection).await.unwrap_or_default(); if let Some(last) = last {