[Catalyst] One App, multiple databases

Jose Luis Martinez jlmartinez-lists-catalyst at capside.com
Wed Nov 19 22:53:49 GMT 2008


Mesdaq, Ali escribió:
> Are these db's exact copies as far as schema from each other? Or is it different tables and structure as well? 
> 
> Reason I am asking is because if its exactly the same and all your queries work the same and your logic works the same as well and the only difference is if user1 is connected then connect to one schema and if user2 is connected connect to another schema you might be able to more cleanly determine the db in your controller code. You would also then create a model for each user. This would give you granular control over if the user db's ever move or if you need to configure specific connection data per users db like different user accounts and passwords etc.
> 
> So instead of something like:
> $c->model('DB::Blah')->all

Yes, they are exactly the same. But I'm not really all that keen on 
creating one model per user (because the users would be created and 
deleted), and that would mean that will have to be added and deleted, 
and app servers restarted.

> But I think knowing a little more about your exact situation might help understand the issue more.

Basically we giving multi-tentant capability to our app (which was 
ported from some old CGIs). The CGIs where setup to load config files 
based on the REMOTE_USER, so we gave each user a separate DB just by 
changing the connect string. Now in Catayst we want the same effect ;), 
as sharing one database between all users is a step we don't want to 
take (for the moment).

Hope that explains a bit more.

Thanks,

Jose Luis Martinez
jlmartinez at capside.com



More information about the Catalyst mailing list