[Catalyst] One (central) app, one schema, X databases

Matt S Trout dbix-class at trout.me.uk
Wed Sep 24 17:02:15 BST 2008


On Wed, Sep 10, 2008 at 10:42:35AM +0100, Chisel Wright wrote:
> I'm just in the initial planning phase of a project.
> 
> The basic idea is to have X locations running App::Location, each with a
> local database that has a App::Location::Schema.
> 
> Everything's the same, just different data in the locations.
> 
> We'd like to have a centralised tool to manage App::Location #1 ...
> App::Location #X - App::Central
> 
> App::Central may have it's own App::Central::Schema, but it should also
> be able to interact with App::Location::Schema #1 ..
> App::Location::Schema #X.

If you only need one location at once, use the approach I was discussing        
in an earlier thread for multiple users.                                        

If you need multiple, maybe add an ACCEPT_CONTEXT onto your M::DBIC::Schema     
that takes a location name, and then modify                                     
                                                                                
        *{"${classname}::ACCEPT_CONTEXT"} = sub {                               
            shift;                                                              
            shift->model($model_name)->resultset($moniker);                     
        }                                                                       
                                                                                
in M::DBIC::Schema itself to do ->model($model_name, @_) then you can do        
                                                                                
$c->model('DB::Foo', 'location1');

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list