[Dbix-class] relationships between schemas, I doubt this will work but...
John Napiorkowski
jjn1056 at yahoo.com
Thu Oct 5 19:15:11 CEST 2006
Sorry for the double post, I'm on this weird notebook
that seems to want to click on every button the cursor
crosses.
Also this question is probably a bit silly, since
there is no way for DBIx::Class to create SQL
statements across databases. I'm trying to convince
the client to move to a clusting system where we can
make these different databases all appear in the same
place.
thanks,
john
--- John Napiorkowski <jjn1056 at yahoo.com> wrote:
> Hi,
>
> I have two mysql databases on different boxes with
> different connect strings. However there is a
> relationship between some tables between these two
> databases. Of course this relationship is not
> enforces inside the database, but that's the way my
> the previous consultant set it up and it's not
> changing anytime soon.
>
> Basically there is one database with a membership
> system and another with a shared album system. The
> membership table in the first has a member_id
> primary
> key, while the album table in the second has a
> column
> called 'member_id' which is a member_id from the
> member database.
>
> I created schemas like this for the members table:
>
> package membership::Schema::db::members;
>
> __PACKAGE__->table("members");
>
> __PACKAGE__->add_columns(
>
> "member_id",
> [rest of tables]
> );
>
> The member_id is the primary key.
>
> and then I created the album schema like so...
>
> package shared_albums::Schema::db::albums;
>
> __PACKAGE__->table("albums");
>
> __PACKAGE__->add_columns(
>
> "album_id",
> "member_id",
> [rest of tables]
> );
>
> When I try to create a relationship between them
> like
> so (in the "shared_albums::Schema::db::albums"
> package):
>
> __PACKAGE__->belongs_to(
>
> member => 'membership::Schema::db::members',
> {
> 'foreign.member_id' => 'self.member_id',
> },
>
> );
>
> I get an error when trying to access something:
>
> Can't find source for
> membership::Schema::db::members
>
>
> I figure this can't work but maybe there is
> something
> I can configure to help out a bit. Has anyone run
> into this before?
>
> Thanks!
>
> John
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
> _______________________________________________
> List:
>
http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN:
>
http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive:
>
http://www.mail-archive.com/[email protected]/
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Dbix-class
mailing list