Bugzilla – Attachment 137603 Details for
Bug 31133
TestBuilder fragile on virtual fks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[ALTERNATIVE-PATCH] Bug 31133: Don't generate values for more than one FK
Bug-31133-Dont-generate-values-for-more-than-one-F.patch (text/plain), 1.53 KB, created by
Jonathan Druart
on 2022-07-12 07:11:53 UTC
(
hide
)
Description:
[ALTERNATIVE-PATCH] Bug 31133: Don't generate values for more than one FK
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-07-12 07:11:53 UTC
Size:
1.53 KB
patch
obsolete
>From 1a8f64555c96aa8b033d7fdefb61dbe2db806c7e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Jul 2022 09:11:12 +0200 >Subject: [PATCH] Bug 31133: Don't generate values for more than one FK > >--- > t/lib/TestBuilder.pm | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 94ffa975103..7ebefd32115 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -334,6 +334,7 @@ sub _getForeignKeys { > > my ( @foreign_keys, $check_dupl ); > my @relationships = $source->relationships; >+ my $col_names = {}; > for my $rel_name( @relationships ) { > my $rel_info = $source->relationship_info($rel_name); > if( $rel_info->{attrs}->{is_foreign_key_constraint} ) { >@@ -342,12 +343,15 @@ sub _getForeignKeys { > > my @keys; > while( my ($col_fk_name, $col_name) = each(%{$rel_info->{cond}}) ) { >+ # If we have more than one FK on the same column, we only generate values for the first one >+ next if exists $col_names->{$col_name}; > $col_name =~ s|self.(\w+)|$1|; > $col_fk_name =~ s|foreign.(\w+)|$1|; > push @keys, { > col_name => $col_name, > col_fk_name => $col_fk_name, > }; >+ $col_names->{$col_name} = 1; > } > # check if the combination table and keys is unique > # so skip double belongs_to relations (as in Biblioitem) >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31133
:
137599
|
137600
|
137603
|
137604
|
137634