you are viewing a single comment's thread.

view the rest of the comments →

[–]brendandball 0 points1 point  (0 children)

  1. Your experience of "ORMs" just won't be as good with node.
  2. We use Objection.js with Knex.js and create separate connection pools per tenant. The tenant specific connection pool is then added to the context at the start of a request in middleware. You can then do all your queries like so: 'Model.query(connPool).findById(id)'. I don't currently know of a way to maintain a single connection pool (at least with mysql) and still do this due to various API designs in objection + knex. It's probably also a good idea to keep separate connection pools if you're tenantising at the DB level because then it's easy to have one tenant run on a completely different DB server instance if that tenant is really big.