Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 129293
Status: new
Priority: 0/
Queue: DBIx-Class

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

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



Subject: is_foreign_key_constraint do not correspond to documentation
https://metacpan.org/pod/DBIx::Class::Relationship::Base#is_foreign_key_constraint is_foreign_key_constraint If you are using SQL::Translator to create SQL for you and you find that it is creating constraints where it shouldn't, or not creating them where it should, set this attribute to a true or false value to override the detection of when to create constraints. But when is_foreign_key_constraint => 0 is used to prevent SQL constraint generation by SQL::Translator it also prevents to insert new records like: my $bank_statement = $rs->create({ docn => $self->app->gen_docn, suma => 0, Details => $payments, }); Where Details is: require HyperMouse::Schema::Result::BankStatement; my $B = 'HyperMouse::Schema::Result::BankStatement'; $B->has_many ( Details => $X, 'bank_statement_id' ); The error is: DBIx::Class::Row::__new_related_find_or_new_helper(): Unable to determine relationship 'Details' direction from 'BankStatement', possibly due to a missing reverse-relationship on 'Details' to 'BankStatement'. at Because my relationship is Bi-Temporal and FKs are implemented manually by triggers. I want to prevent SQL constraint generation. But I do not want to say that there is no relationship between BankStatement and BankStatementDetails by is_foreign_key_constraint => 0 I do not expect this. The relationship must not be broken is is_foreign_key_constraint => 0 defined and is zero.
is_foreign_key_constraint is analized here: DBIx/Class/ResultSource.pm:1739
According to comment at that line: # don't assume things if the relationship direction is specified probably code should looks like: return 1 if exists ($relinfo->{attrs}{is_foreign_key_constraint});