* Check in MySQL parser to avoid trying to parse a table defined twice in the same
file as indices (and probably other things) get messed up
* Workaround for some MySQL quirks on primary key definitions
+* MySQL producer does not attempt to write out non-existent unique constraint names
# ----------------------------------------------------------
# 0.11010 2011-10-05
return 'PRIMARY KEY (' . $qf . join("$qf, $qf", @fields). $qf . ')';
}
elsif ( $c->type eq UNIQUE ) {
- return
- 'UNIQUE '.
- (defined $c->name ? $qf.truncate_id_uniquely( $c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH ).$qf.' ' : '').
- '(' . $qf . join("$qf, $qf", @fields). $qf . ')';
+ return sprintf 'UNIQUE %s(%s)',
+ ((defined $c->name && $c->name)
+ ? join ('',
+ $qf,
+ truncate_id_uniquely( $c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH ),
+ $qf,
+ ' '
+ )
+ : ''
+ ),
+ ( join ', ', map { "${qf}${_}${qf}" } @fields ),
+ ;
}
elsif ( $c->type eq FOREIGN_KEY ) {
#