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

Paul Findlay Paul.Findlay at fonterra.com
Sun Mar 24 22:58:31 GMT 2013


> I tried to use delete_all, but there is no primary key in the table so it failed. what else can i do?

There is a discussion in the manual about this:
https://metacpan.org/module/DBIx::Class::Manual::Intro#The-Significance-and-Importance-of-Primary-Keys

But you could alternatively use
$schema->resultset('Mytable')->delete;

But this won't execute any on-delete triggers or cascade to MyTable's relationships.

- Paul

DISCLAIMER
This email contains information that is confidential and which may be legally privileged. If you have received this email in error, please notify the sender immediately and delete the email. This email is intended solely for the use of the intended recipient and you may not use or disclose this email in any way.



More information about the DBIx-Class mailing list