Setup for multiple databases
Looking to get some help on how to configure drizzle with an application that connects to multiple databases.
Establishing different connection pools is pretty intuitive, but I could use some help understanding the setup for different configs for each database and different migration directories.
8 Replies
Are this databases related in some way? Are they replicas?
Nope, no relationship
We might have an analytics db that does some replication with AWS DMS in the future, but not likely right now
Are you migrating from another ORM? How did you handle this before?
I would suggest creating a new db instance with the drizzle function separately.
If you also want to handle the schema and migrations with drizzle, you should definitely have those in different folders to make sure they're not interfering with each other
How would I properly setup the config to support 2 dbs? All the examples show a default config so its not clear to me how 2 would be supported.
You would probably need different drizzle config files for each
Check for example this repo, that I usually use for manual tests
GitHub
GitHub - rphlmr/drizzle-playground
Contribute to rphlmr/drizzle-playground development by creating an account on GitHub.
Then you can set up the appropriate one per database in the scripts key in you package.json
@Angelelz thank you! This is exactly what I needed.