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

Chisel Wright chisel at herlpacker.co.uk
Wed Sep 10 10:42:35 BST 2008


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.

This is where I'm unsure how to proceed.

I'd like to have a configuration list that boils down to something like:

  instance1: dsn_host=location1.foo.com
  instance2: dsn_host=location2.foo.com
  ...
  instanceX: dsn_host=locationX.foo.com

and have some form of cunningness or magic that turns this into an
accessible DBIC model.

I'm aware that I could use
http://search.cpan.org/~zarquon/Catalyst-Manual-5.7013/lib/Catalyst/Manual/Cookbook.pod#Using_existing_DBIC_(etc.)_classes_with_Catalyst
(http://xrl.us/oqs9o) and create a MyApp::Model::Location1::DB and so
on, but this seems wrong.

If I've made any sense, does anyone have any docs that I should be
looking at (I promise I had a look around), or examples of where they've
done the same thing?

I'm thinking that there might be a solution involving a
App::Model::MiddleLayer that provides something like:

  App::Model::MiddleLayer->schema( $instance_name )

but it's a vague idea that I can't quite get to solidify in my head.


Thanks for reading this far!

Chisel
-- 
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

  Chuck Norris doesn’t wear a watch,
  HE decides what time it is.



More information about the Catalyst mailing list