From 591f7479957f55642c9859ebc0c2d6aeb218ba08 Mon Sep 17 00:00:00 2001 From: Stephen Cirner Date: Wed, 29 Sep 2021 11:22:31 -0400 Subject: [PATCH] Run migrations before initial cache seeding. --- bin/env | 2 +- src/main.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/env b/bin/env index 1d14efd..481154d 100644 --- a/bin/env +++ b/bin/env @@ -6,7 +6,7 @@ export DB_PORT=5432 export DB_USER=postgres export DB_PASS=password1 export DB_NAME=object-store -export DB_SCHEMA=object-store +export DB_SCHEMA=public export URI_HOST=figure.com export STORAGE_TYPE=file_system export STORAGE_BASE_PATH=storage_bucket diff --git a/src/main.rs b/src/main.rs index 0368d4f..9e13a28 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,6 +87,10 @@ async fn main() -> Result<()> { .connect(config.db_connection_string().as_ref()) .await?; + log::debug!("Running migrations"); + + MIGRATOR.run(&pool).await?; + // populate initial cache for (public_key, url) in datastore::get_all_public_keys(&pool).await? { if let Some(url) = url { @@ -107,8 +111,6 @@ async fn main() -> Result<()> { let config = Arc::new(config); let storage = Arc::new(storage); - MIGRATOR.run(&*pool).await?; - let (mut health_reporter, health_service) = tonic_health::server::health_reporter(); let public_key_service = PublicKeyGrpc::new(Arc::clone(&cache), Arc::clone(&pool)); let mailbox_service = MailboxGrpc::new(Arc::clone(&pool));