{
# 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)) {