Skip Menu |

This queue is for tickets about the Catalyst-Plugin-AutoCRUD CPAN distribution.

Report information
The Basics
Id: 71763
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-AutoCRUD

People
Owner: Nobody in particular
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.112770
Fixed in: (no value)



Subject: can't delete row from Ajax table interface (fkey issue?)
2 Tables. CREATE TABLE access_paths ( path text NOT NULL, CONSTRAINT access_paths_pkey PRIMARY KEY (path) ) WITHOUT OIDS; CREATE TABLE auth_paths ( username text NOT NULL, path text NOT NULL, CONSTRAINT auth_paths_pkey PRIMARY KEY (username, path), CONSTRAINT auth_paths_path_fkey FOREIGN KEY (path) REFERENCES access_paths (path) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE ) WITHOUT OIDS; When I use AutoCRUD and select to delete a row from auth_paths, it asks me "do you want to delete <username here>?" I would think it should also specify the path, which I think is the problem. When I inject debug into Catalyst::Plugin::AutoCRUD::Model::Backend::DBI::delete, I'm noticiing that a dump of $params->{key} is just a single string corresponding to the user ID, not username/path, which is the primary key...
$>perl -MCatalyst::Plugin::AutoCRUD -E'say $Catalyst::Plugin::AutoCRUD::VERSION' 1.112770
On Tue Oct 18 13:46:33 2011, TODDR wrote: Show quoted text
> CONSTRAINT auth_paths_pkey PRIMARY KEY (username, path), > > When I inject debug into > Catalyst::Plugin::AutoCRUD::Model::Backend::DBI::delete, I'm noticiing > that a dump of $params->{key} is just a single string corresponding to > the user ID, not > username/path, which is the primary key...
Spot on. I regret there are limitations with the current stable release surrounding composite/compound primary keys like this. It's something I've been working on though, and the dev release on CPAN (_003 as I write) has good and working support for such things. Sorry for any inconvenience this caused, but I'm confident you'll find the new release much more usable. regards, oliver.
FYI I've reopened this ticket until we have it fixed. regards, oliver.
Relevant Schema attached.
Subject: TableDBICSchema.txt
package foo::Result::AccessPath; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE use strict; use warnings; use Moose; use MooseX::NonMoose; use namespace::autoclean; extends 'DBIx::Class::Core'; __PACKAGE__->load_components("InflateColumn::DateTime"); =head1 NAME foo::Result::AccessPath =cut __PACKAGE__->table("access_paths"); =head1 ACCESSORS =head2 path data_type: 'text' is_nullable: 0 =cut __PACKAGE__->add_columns("path", { data_type => "text", is_nullable => 0 }); __PACKAGE__->set_primary_key("path"); =head1 RELATIONS =head2 auth_paths Type: has_many Related object: L<foo::Result::AuthPath> =cut __PACKAGE__->has_many( "auth_paths", "foo::Result::AuthPath", { "foreign.path" => "self.path" }, { cascade_copy => 0, cascade_delete => 0 }, ); # Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-10-17 19:47:55 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oCBranK6r9TtBz8GjwolxQ # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; 1; package foo::Result::AuthPath; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE use strict; use warnings; use Moose; use MooseX::NonMoose; use namespace::autoclean; extends 'DBIx::Class::Core'; __PACKAGE__->load_components("InflateColumn::DateTime"); =head1 NAME foo::Result::AuthPath =cut __PACKAGE__->table("auth_paths"); =head1 ACCESSORS =head2 username data_type: 'text' is_nullable: 0 =head2 path data_type: 'text' is_foreign_key: 1 is_nullable: 0 =cut __PACKAGE__->add_columns( "username", { data_type => "text", is_nullable => 0 }, "path", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, ); __PACKAGE__->set_primary_key("username", "path"); =head1 RELATIONS =head2 path Type: belongs_to Related object: L<foo::Result::AccessPath> =cut __PACKAGE__->belongs_to( "path", "foo::Result::AccessPath", { path => "path" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); # Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-10-17 19:47:55 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WZ4q1F7iYaPVBfIyOU5VCQ # You can replace this text with custom code or comments, and it will be preserved on regeneration __PACKAGE__->meta->make_immutable; 1;
Resvoled by upgrading. regards, oliver.