Skip to content

Commit

Permalink
Run migrations before initial cache seeding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Cirner committed Sep 29, 2021
1 parent 1db61fc commit 591f747
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/env
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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));
Expand Down

0 comments on commit 591f747

Please sign in to comment.