fix: run postgres migration on startup

This commit is contained in:
Greg Heartsfield 2023-01-24 08:04:37 -06:00
parent 16f6e974c8
commit 25752abe6b

View File

@ -62,9 +62,13 @@ async fn build_postgres_pool(settings: &Settings, metrics: NostrMetrics) -> Post
.connect_with(options) .connect_with(options)
.await .await
.unwrap(); .unwrap();
PostgresRepo::new(pool, metrics, PostgresRepoSettings { let repo = PostgresRepo::new(pool, metrics, PostgresRepoSettings {
cleanup_contact_list: true cleanup_contact_list: true
}) });
if let Ok(version) = repo.migrate_up().await {
info!("Postgres migration completed, at v{}", version);
}
repo
} }
/// Spawn a database writer that persists events to the `SQLite` store. /// Spawn a database writer that persists events to the `SQLite` store.