Multiple DB support #3030
-
I need to support two different PSQL DBs, one of which might end up running in a separate cluster some day. What is the idiomatic way to support this correctly using diesel? i.e. I need to ensure that migrations are kept in isolated directories. I am hoping that I don't have to create a library for one of them, but diesel.toml seems to be restricted to a single DB in a project TIA, -Dave |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That's literally the only place where there is an assumption about a single database connection and that's the only place where it's reasonable to assume such thing. Generally speaking: If you use diesel-cli for managing stuff, you just want to use the command line options to set different connections/migration dirs. If you use diesel, it's even easier as different connections can point to different databases. How you actually setup and manage them, that's part of your implementation. |
Beta Was this translation helpful? Give feedback.
That's literally the only place where there is an assumption about a single database connection and that's the only place where it's reasonable to assume such thing.
Generally speaking: If you use diesel-cli for managing stuff, you just want to use the command line options to set different connections/migration dirs. If you use diesel, it's even easier as different connections can point to different databases. How you actually setup and manage them, that's part of your implementation.