Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Using DBIx::Class To Delete Row With Foreign Keys

by varanasi (Scribe)
on Jan 24, 2019 at 17:20 UTC ( [id://1228932]=note: print w/replies, xml ) Need Help??


in reply to Re: Using DBIx::Class To Delete Row With Foreign Keys
in thread Using DBIx::Class To Delete Row With Foreign Keys

Yes! There is one table, Roster, that does:

package Test::Schema::Result::Roster; . . . __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0}, "member_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, ); . . . __PACKAGE__->belongs_to( "member", "Test::Schema::Result::Member", { id => "member_id" }, { is_deferrable => 0, join_type => "LEFT", on_delete => "NO ACTION", on_update => "NO ACTION", }, ); ------------sql------ CREATE TABLE roster ( id INTEGER PRIMARY KEY, member_id INTEGER REFERENCES member(id) );

Replies are listed 'Best First'.
Re^3: Using DBIx::Class To Delete Row With Foreign Keys
by poj (Abbot) on Jan 24, 2019 at 17:31 UTC

    In that case, delete the roster records before deleting the member.

    poj

      Well, perfect! I now understand the problem (and why I couldn't figure it out before.) I feel slightly less dumb.

      Edit: I had left some test records in roster. Sigh.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228932]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found