added branch no_duplicate_indexes_for_pk_cols with test and fix
[dbsrgits/DBIx-Class.git] / lib / SQL / Translator / Parser / DBIx / Class.pm
index d67ce9e..2aa5098 100644 (file)
@@ -210,10 +210,15 @@ sub parse {
             {
                 # Constraints are added only if applicable
                 next unless $fk_constraint;
-
+                
                 # Make sure we dont create the same foreign key constraint twice
                 my $key_test = join("\x00", sort @keys);
                 next if $created_FK_rels{$rel_table}->{$key_test};
+                
+                # Make sure we dont create additional indexes for the
+                # primary columns
+                my $pk_test = join("\x00", sort @primary);
+                next if $key_test eq $pk_test;
 
                 if (scalar(@keys)) {