Matija Grabnar wrote:
Is this something that database theory makes impossible (and I just didn't know it) or is this a bug in DBIx::Class?

Summary: Say I have two Classes, in a belongs_to / has_many relationship, but with one important difference: the belongs_to relationship does not go to the primary key of the other table, but to another key. When I try to do that, I get an extra constraint that prevents me from inserting anything into the table.

Commenting to my own message, but I looked at the source of SQL::Translator::Parser::DBIx::Class.pm, and that decision is made explicitly: the code checks if the target of the relationship is the whole of the primary keys, and if not, it adds an addition foreign key constraint.

Again, this constraint gets in my way pretty badly, and I think it is somewhat too strict. As I understand it, there is no need for the target of the belongs_to relationship to be the primary key, all that you need to ensure is that it be a UNIQUE key.

I'm rewriting the if statement that does this, and what I've written so far seems to pass the tests defined in 86sqlt.t, so I don't think I'm getting rid of any foreign key constraints that _should_ be there.

I hope I'll be able to submit a full patch very soon.

Best regards,
               Matija Grabnar


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to