Compare commits

...

1 Commits

Author SHA1 Message Date
Gleb Novikov
4f79f8c0d1 WIP: fast-import: change postgres database to neondb 2024-12-19 18:33:23 +00:00

View File

@@ -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
//