[DBIx-Class-Devel] [dbix-class] Allow SQLT options to be passed to unique constraints (#88)

Peter Rabbitson notifications at github.com
Tue Nov 3 15:01:22 GMT 2015


> @@ -149,13 +149,16 @@ sub parse {
>  
>          $table->primary_key(@primary) if @primary;
>  
> -        my %unique_constraints = $source->unique_constraints;
> -        foreach my $uniq (sort keys %unique_constraints) {
> -            if (!$source->_compare_relationship_keys($unique_constraints{$uniq}, \@primary)) {
> +        my $unique_constraints = $source->unique_constraints_info;
> +        foreach my $uniq (sort keys %$unique_constraints) {
> +            my $cons = $unique_constraints->{$uniq};

Don't add extremely short-lived intermediate variables like that, it makes code harder to reason about, as in *why did he save it only to use it a couple times in this function, what am I missing*

---
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/dbix-class/pull/88/files#r43757134
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20151103/20509602/attachment-0001.htm>


More information about the DBIx-Class-Devel mailing list