Fix temporary database handling on postgres
@@ -177,6 +177,7 @@ impl SqlFlavour for PostgresFlavour {
tracing::debug!("Connecting to temporary database at {}", temporary_database_url);
+ let sql_schema = {
let temporary_database = crate::connect(&temporary_database_url).await?;
temporary_database.raw_cmd(&create_schema).await?;
@@ -194,7 +195,10 @@ impl SqlFlavour for PostgresFlavour {
})?;
}
- let sql_schema = self.describe_schema(&temporary_database).await?;
+ // the connection to the temporary database is dropped at the end of
+ // the block.
+ self.describe_schema(&temporary_database).await?
+ };
connection.raw_cmd(&drop_database).await?;
