FAQ
Hi all,

I have classes mentioned below.
Then I tried:

my $schema = CD::Schema->connect('dbi:SQLite:cd.db');
$schema->resultset('Artists')->delete_all;

It will delete all artists and albums, but doesn't delete tracks.
Does not DBIx::Class support recursive cascade deletion?

Regards.

Hide

---

package CD::Schema::Artists;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/Core/);
__PACKAGE__->table('artists');
__PACKAGE__->add_columns(qw/ id name /);
__PACKAGE__->set_primary_key('id');

__PACKAGE__->has_many('albums' => 'CD::Schema::Albums', 'artist');

1;



package CD::Schema::Albums;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/Core/);
__PACKAGE__->table('albums');
__PACKAGE__->add_columns(qw/ id artist title /);
__PACKAGE__->set_primary_key('id');

__PACKAGE__->belongs_to('artist' => 'CD::Schema::Artists');
__PACKAGE__->has_many('tracks' => 'CD::Schema::Tracks', 'album');

1;



package CD::Schema::Tracks;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/Core/);
__PACKAGE__->table('tracks');
__PACKAGE__->add_columns(qw/ id album title /);
__PACKAGE__->set_primary_key('id');

__PACKAGE__->belongs_to('album' => 'CD::Schema::Albums');

1;

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupdbix-class @
categoriesperl, catalyst
postedMar 5, '06 at 11:16p
activeMar 5, '06 at 11:16p
posts1
users1
websitedbix-class.org
irc#dbix-class

1 user in discussion

Hideo Kimura: 1 post

People

Translate

site design / logo © 2022 Grokbase