[Dbix-class] how to empty a Table? when there is no primary key

David Cantrell david at cantrell.org.uk
Wed Mar 27 12:33:42 GMT 2013


On Wed, Mar 27, 2013 at 06:12:49AM +1100, Peter Rabbitson wrote:
> On Mon, Mar 25, 2013 at 03:57:45PM +0000, David Cantrell wrote:
> > I've always thought that this is something that should be handled by the
> > database, not by DBIx::Class - or at least that it should be something
> > that you have to explicitly turn on in DBIx::Class to support data
> > sources which don't really do relationships.
> When DBIC was first worked on (2005) most available data sources either 
> did not handle FK constraints or (much more often the case, even today) 
> did not have them declared.

Not having them declared in the table definitions is, IMO, a bug in the
database design and the application.

>                             As such the default of cascade_delete [1] is 
> true for has_many's, as it is generally harmless (though wasteful) if 
> FK-Cs are present, but is life-saving when they are not.
> 
> There is a plan on how to take folks "off the needle" but it requires a 
> bit more work in the ResultSource area and eeryone capable of doing it 
> has been busy lately.

Ah, OK.  I'll try to remember not to whinge about this in future then :-)

-- 
David Cantrell | London Perl Mongers Deputy Chief Heretic

Aluminum makes a nice hat.  
All paranoids will tell you that.
But what most do not know     
Is reflections will show    
On the CIA's evil landsat.



More information about the DBIx-Class mailing list