From 22b173530a931409614b379a2118df5d8d554db4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 25 Nov 2022 13:17:46 +0100 Subject: [PATCH] Bug 32353: Pick the default value for FK --- t/lib/TestBuilder.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index 8f90e37b250..98b6518e258 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -404,6 +404,11 @@ sub _buildColumnValue { return; } # otherwise: no need to assign a value + } elsif( !exists $value->{$col_name} + && exists $self->{default_values}{$source}{$col_name} ) { + my $v = $self->{default_values}{$source}{$col_name}; + $v = &$v() if ref($v) eq 'CODE'; + push @$retvalue, $v; } elsif( $col_info->{is_foreign_key} || _should_be_fk($source,$col_name) ) { if( exists $value->{$col_name} ) { if( !defined $value->{$col_name} && !$col_info->{is_nullable} ) { @@ -427,10 +432,6 @@ sub _buildColumnValue { return; } push @$retvalue, $value->{$col_name}; - } elsif( exists $self->{default_values}{$source}{$col_name} ) { - my $v = $self->{default_values}{$source}{$col_name}; - $v = &$v() if ref($v) eq 'CODE'; - push @$retvalue, $v; } else { my $data_type = $col_info->{data_type}; $data_type =~ s| |_|; -- 2.25.1