Open jaemk opened 4 years ago
This would be great!
I happen to have an issue now with migrant when using Postgres. I want to setup our tests to use separate schemas, but since every time migrant
is making a new connection and I can't SET SESSION SCHEMA test_X
.
I good starting point would be to:
Lazy
to establish connection only once and use it for all migrations: https://crates.io/crates/once_cell~ This won't workConfig
(maybe a more accurate name could be used) and wrapping it in Arc
for cheap cloningtokio_postgres
(https://crates.io/crates/tokio-postgres/). This connection could even be passed when you have connection pools like https://crates.io/crates/bb8 (sync), https://crates.io/crates/r2d2 (sync), https://crates.io/crates/deadpool (async), etcThese are my thoughts, I thought I would share them with you. What do you think?
Instead of creating a new connection for each operation, which is cruft related to #25 . This would also unblock #6