I am looking to do a multi-tenant website with one database for each tenant. (SaaS - Me and my team have gone through all the pros and cons for all our requirements and we decided on it).
With Lucid I thought about extend the Provider but I don’t think that will work.
I tried a bit with Objection JS and it works great. Why?
Because I can just specify the correct connection when doing queries like:
MyModel.query(myNewConnection).findOne( ... )
I basically have a middleware that creates that said connection by looking at the subdomain of the request and that corresponds to part of the database from the tenant.
With Lucid I can’t find a way to do that. Is there a way by extending the service provider that I’m not seeing? So that when I use a Model for a query it uses a new connection?