[Dbix-class] copying between databases

Alan Humphrey alan.humphrey at comcast.net
Thu Feb 9 03:41:10 CET 2006


I've been thinking along the same lines.  My only concern is making sure
there's an end to the recursion (i.e. no cycles in the table relationships).
I'll play with it tomorrow and see what I come up with.

- Alan

-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of David Kamholz
Sent: Wednesday, February 08, 2006 6:01 PM
To: dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] copying between databases

Hmm... shouldn't be too hard to do, I suppose. Sounds like a useful  
thing, so I might just try to write something up to do it. $obj- 
 >result_source->relationships gives you a list of relationships, and  
relationship_info gives you the necessary details. You'd then just  
need a recursive function clever enough to do the right  
create_related (probably find_or_create_related) calls.

Dave

On Feb 8, 2006, at 7:48 PM, Alan Humphrey wrote:
> Before I get too deep into this problem I thought I'd ask here,  
> just in case there's a simple solution I'm not seeing.
>
> I have two databases sharing a schema.  The staging database gets  
> edited and, eventually, the edits are "published" to the production  
> database.
>
> Question: is there a straightforward way to copy a record *and all  
> of the related data* from one database to another?
>
> Thanks!
>
> - Alan

_______________________________________________
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/




More information about the Dbix-class mailing list