[Dbix-class] Multi-tennant application/data and dbix-class

Aaron Trevena aaron.trevena at gmail.com
Fri Jan 12 13:29:23 GMT 2018


Hi Trevor,

On 11 January 2018 at 17:43, Trevor Leffler <tleffler at uw.edu> wrote:
> I do something a little different in my multi-tenant application. Each customer gets a subdomain and their own database schema. The subdomain string is passed to my catalyst schema model, which maps it to the correct schema and performs a 'USE' prior to executing any queries.
>
> I appreciate the separation of customer data and whatever safety that may afford me, restoration of customer data is cleaner for me, as is data deletion, and probably some other things I'm not thinking of at the moment. On the other hand, performing queries across all customer datasets becomes more challenging.

We have a hierarchy so that's very much a non-starter, also it's not
going to scale to the level we need with users creating their own
sub-tenants.

have you looked at
https://metacpan.org/release/Catalyst-TraitFor-Component-ConfigPerSite
- I wrote it with the kind of thing you're doing in mind - allows you
to swap not just the db schema, but also the templates, styling and
other configuration per subdomain (or even uri path)

Cheers,

A.

-- 
Aaron J Trevena, BSc Hons
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Consulting



More information about the DBIx-Class mailing list