Re: [Dbix-class] Cascade deletes

2010-03-10 Thread Peter Rabbitson
Pedro Melo wrote: Hi, On Tue, Mar 9, 2010 at 10:23 PM, Bill Moseley mose...@hank.org wrote: On Sat, Mar 6, 2010 at 1:24 AM, Pedro Melo m...@simplicidade.org wrote: I did that once for exactly the same reasons. Created a DBIC component that overrides add_relationship(). The fourth parameter

Re: [Dbix-class] Cascade deletes

2010-03-10 Thread Bill Moseley
On Wed, Mar 10, 2010 at 11:38 AM, Peter Rabbitson rabbit+d...@rabbit.usrabbit%2bd...@rabbit.us wrote: As you already realized down the thread, this is the wrong place to add a default. It's the individual cascade-setting helper that you need to override: sub has_many { my ($self, @args)

Re: [Dbix-class] Cascade deletes

2010-03-09 Thread Bill Moseley
On Sat, Mar 6, 2010 at 1:24 AM, Pedro Melo m...@simplicidade.org wrote: First, is there a way to globally disable cascade deletes? I did that once for exactly the same reasons. Created a DBIC component that overrides add_relationship(). The fourth parameter is the hashref with the options,

Re: [Dbix-class] Cascade deletes

2010-03-06 Thread Pedro Melo
Hi, On Sat, Mar 6, 2010 at 1:07 AM, Bill Moseley mose...@hank.org wrote: First, is there a way to globally disable cascade deletes?  I know I can add cascade_delete = 0 to the relationships, but I never want cascade deletes in the ORM (I have a database that does that). I did that once for

Re: [Dbix-class] Cascade deletes

2010-03-06 Thread Peter Rabbitson
Bill Moseley wrote: First, is there a way to globally disable cascade deletes? I know I can add cascade_delete = 0 to the relationships, but I never want cascade deletes in the ORM (I have a database that does that). Second, Say I have my music db and an error in a relationship name.

Re: [Dbix-class] Cascade deletes

2010-03-06 Thread Moritz Onken
I notice that DBIC does a select to find the related rows (i.e. in the Cd table when looking for rows to cascade delete). Is there a reason that's done instead of just deleting directly? INSERT INTO artist ( label, name) VALUES ( ?, ? ): '1', 'test aritst' INSERT INTO cd ( artist)

Re: [Dbix-class] Cascade deletes

2010-03-06 Thread Bill Moseley
On Sat, Mar 6, 2010 at 3:59 AM, Peter Rabbitson rabbit+d...@rabbit.usrabbit%2bd...@rabbit.us wrote: I notice that DBIC does a select to find the related rows (i.e. in the Cd table when looking for rows to cascade delete). Is there a reason that's done instead of just deleting directly?

Re: [Dbix-class] Cascade deletes

2010-03-06 Thread Peter Rabbitson
Bill Moseley wrote: On Sat, Mar 6, 2010 at 3:59 AM, Peter Rabbitson rabbit+d...@rabbit.us mailto:rabbit%2bd...@rabbit.us wrote: I notice that DBIC does a select to find the related rows (i.e. in the Cd table when looking for rows to cascade delete). Is there a reason

[Dbix-class] Cascade deletes

2010-03-05 Thread Bill Moseley
First, is there a way to globally disable cascade deletes? I know I can add cascade_delete = 0 to the relationships, but I never want cascade deletes in the ORM (I have a database that does that). Second, Say I have my music db and an error in a relationship name. Then I do this: my $artist =