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

Are there any other tables which use member.user_id and have constraints ?

poj

Replies are listed 'Best First'.
Re^2: Using DBIx::Class To Delete Row With Foreign Keys
by varanasi (Scribe) on Jan 24, 2019 at 17:20 UTC

    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) );

      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.