Skip to content

Commit

Permalink
WIP: fast-import: change postgres database to neondb
Browse files Browse the repository at this point in the history
  • Loading branch information
NanoBjorn committed Dec 19, 2024
1 parent 04517c6 commit 4f79f8c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion compute_tools/src/bin/fast_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,26 @@ pub(crate) async fn main() -> anyhow::Result<()> {
format!("host=localhost port=5432 user={superuser} dbname=postgres");
loop {
let res = tokio_postgres::connect(&restore_pg_connstring, tokio_postgres::NoTls).await;
if res.is_ok() {
if let Ok((client, connection)) = res {
info!("postgres is ready, could connect to it");

tokio::spawn(async move {
if let Err(e) = connection.await {
eprintln!("connection error: {}", e);
}
});

client
.execute("CREATE DATABASE neondb", &[])
.await
.context("create database neondb")?;

break;
}
}

let restore_pg_connstring = restore_pg_connstring.replace("dbname=postgres", "dbname=neondb");

//
// Decrypt connection string
//
Expand Down

0 comments on commit 4f79f8c

Please sign in to comment.