aboutsummaryrefslogtreecommitdiffstats
path: root/lib/warden-core/src/state/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/warden-core/src/state/mod.rs')
-rw-r--r--lib/warden-core/src/state/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/warden-core/src/state/mod.rs b/lib/warden-core/src/state/mod.rs
index f4692c2..18e44b8 100644
--- a/lib/warden-core/src/state/mod.rs
+++ b/lib/warden-core/src/state/mod.rs
@@ -1,5 +1,6 @@
pub(crate) mod database;
use sqlx::PgPool;
+use tracing::{debug, trace};
use tracing_subscriber::EnvFilter;
use crate::{WardenError, config::Configuration};
@@ -15,6 +16,9 @@ pub struct AppState {
impl AppState {
pub async fn new(log_handle: LogHandle, config: &Configuration) -> Result<Self, WardenError> {
let database = database::connect(&config.database).await?;
+ trace!("running database migrations");
+ sqlx::migrate!("../../migrations").run(&database).await?;
+ debug!("database up to date");
Ok(Self {
log_handle,