Strapi Version: 4.0.5
Database: Postgres 13.3
Node Version: 16
Is it still possible to have multiple database connections in v4?
In v3 we can define multiple database connections in the database.js configuration and have different connections for each collection. However this does not seem to be the case in v4.
My use case is to be able to use read replica DBs on a collection that is frequently accessed, and use read/write database for the rest. May I ask if is this behavior would be possible in v4?
Even I am facing same problem. How do we connect to multiple database connections in v4
Same problem with v4. I tryed different syntaxes, nothing seem to work.
Did you find a solution ?
I might need to do this at some point and Strapi doesn’t have it inbuilt.
Have you tried establishing a new connection in the bootstrap function?
This is really frustrating, things that worked on V3 doesn’t work on V4.
Developers have various reasons to do so, one important reason being that if you want to separate two very different set of functional components in a database.
In my case, I use Postgres and use a database with two schemas, one for UI interactivity and logic and then I use another schema within the same database for analytics. I require Strapi to connect to both schemas.
This is not possible with Strapi V4. Very frustrating to learn that functionality that worked in a previous version is now missing. I wouldn’t upgrade to V4 if V3 had sufficient support for customising requests.
This is a lose-lose situation as I have no way of combining best of both versions.
Feature requested, please vote if you agree.
I found this has been covered previously in another post, but this solution requires an external ProxySQL server. Is it not possible to direct all writes to a master db and all reads to the read replicas within the strapi database config?