[DBIx-Class] Using multiple databases / schemas in DBIC and Catalyst

jagdish eashwar jagdish.eashwar at gmail.com
Sun Aug 3 15:09:41 BST 2008


Hi Matt,

It took me some time, but I eventually could get the relationships working.
Thank you very much. Is what you told me documented anywhere? I am asking so
that I can refer to it in future. I couldn't find it on CPAN.

Jagdish

On Tue, Jul 22, 2008 at 3:13 AM, Matt S Trout <dbix-class at trout.me.uk>wrote:

> On Sun, Jul 20, 2008 at 10:00:46PM +0530, jagdish eashwar wrote:
> > Hi Matt,
> >
> > I wanted to use more than one database / schema in a web application
> using
> > Catalyst and DBIC.  In this connection, I had asked a question on the
> > Catalyst mailing list because I was not able to set up relationships
> between
> > tables in two separate Mysql schemas. You replied that it was possible =
if
> > separate DBIC namespaces were set up, and suggested that for further
> > discussion, I should ask the question on the DBIx mailing list.
> >
> > To recap, I am working on two small Catalyst web applications.  One dea=
ls
> > with the leave particulars of the employees  and the other with the
> hardware
> > issued to them. Both these applications use some common information abo=
ut
> > the employees. At present, I am maintaining these 'common' tables in the
> > schemas of both the applications. I would like to put the 'common' tabl=
es
> in
> > a third schema and make the two applications access them from there.
>
> Ok.
>
> MyBaseSchema should load classes for the common database using
> ->table('common.foo')
>
> MyOneSchema should use base MyBaseSchema and load classes for the specific
> db.
>
> That'll give you a single DBIC schema that covers both databases. Then re=
ls
> will work.
>
> A DBIx::Class::Schema subclass does -not- have to correspond to a single
> database/schema on the db server end. If you need cross-rels, the classes
> all need to be registered within a single DBIC schema, but there's no
> reason the tables can't live in more than one mysql db or pg schema or
> whatever.
>
> That's the important difference I've been trying to explain - make more
> sense now?
>
> --
>      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 platfor=
m?
> http://chainsawblues.vox.com/
> http://www.shadowcat.co.uk/servers/
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.rawmode.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080803/1b4=
f5177/attachment.htm


More information about the DBIx-Class mailing list