No longer require caveat on unique \%options ghpr/closed/inspiring_pr_88
Alastair McGowan-Douglas [Tue, 3 Nov 2015 13:29:49 +0000 (13:29 +0000)]
lib/DBIx/Class/ResultSource.pm
lib/SQL/Translator/Parser/DBIx/Class.pm

index 23be5ea..12eccc1 100644 (file)
@@ -728,8 +728,8 @@ name.
 
 The options hashref will be passed to
 L<SQL::Translator::Schema::Constraint/new>; the intention being to
-allow the C<deferrable> flag to be set. You should avoid putting 
-C<name>, C<fields>, or C<type> in here.
+allow the C<deferrable> flag to be set, but you may find others 
+useful. Note that C<name>, C<type>, and C<fields> will be ignored.
 
 Unique constraints are used, for example, when you pass the constraint
 name as the C<key> attribute to L<DBIx::Class::ResultSet/find>. Then
index 7552496..ba5e75d 100644 (file)
@@ -154,10 +154,10 @@ sub parse {
         foreach my $uniq (sort keys %unique_constraints) {
             if (!$source->_compare_relationship_keys($unique_constraints{$uniq}, \@primary)) {
                 $table->add_constraint(
+                            %{ $unique_constraints_extra{$uniq} // {} },
                             type             => 'unique',
                             name             => $uniq,
                             fields           => $unique_constraints{$uniq},
-                            %{ $unique_constraints_extra{$uniq} // {} },
                 );
             }
         }