/foreign key/i
{ $return = '' }
-primary_key_def : primary_key index_name(?) '(' name_with_opt_paren(s /,/) ')' index_type(?)
+primary_key_def : primary_key index_name_not_using(?) index_type(?) '(' name_with_opt_paren(s /,/) ')' index_type(?)
{
$return = {
supertype => 'constraint',
- name => $item{'index_name(?)'}[0],
+ name => $item[2][0],
type => 'primary_key',
- fields => $item[4],
- options => $item[6][0],
+ fields => $item[5],
+ options => $item[3][0] || $item[7][0],
};
}
-unique_key_def : UNIQUE KEY(?) index_name(?) '(' name_with_opt_paren(s /,/) ')'
+unique_key_def : UNIQUE KEY(?) index_name_not_using(?) index_type(?) '(' name_with_opt_paren(s /,/) ')' index_type(?)
{
$return = {
supertype => 'constraint',
- name => $item{'index_name(?)'}[0],
+ name => $item[3][0],
type => 'unique',
- fields => $item[5],
+ fields => $item[6],
+ options => $item[4][0] || $item[8][0],
}
}
-normal_index : KEY index_name_not_using(?) index_type(?) '(' name_with_opt_paren(s /,/) ')'
+normal_index : KEY index_name_not_using(?) index_type(?) '(' name_with_opt_paren(s /,/) ')' index_type(?)
{
$return = {
supertype => 'index',
type => 'normal',
name => $item[2][0],
fields => $item[5],
- options => $item[3][0],
- }
+ options => $item[3][0] || $item[7][0],
+ }
}
index_name_not_using : QUOTED_NAME
- | /(\b(?!using)\w+\b)/ { $return = $1 }
+ | /(\b(?!using)\w+\b)/ { $return = ($1 =~ /^using/i) ? undef : $1 }
index_type : /using (btree|hash|rtree)/i { $return = uc $1 }
date timestamp,
time_stamp2 timestamp,
KEY (i1),
- UNIQUE (date, i1),
+ UNIQUE (date, i1) USING BTREE,
KEY date_idx (date),
KEY name_idx (name(10))
) TYPE=MyISAM PACK_KEYS=1;
shipping_charge decimal(8,2),
price_paid decimal(8,2),
PRIMARY KEY (order_id) USING BTREE,
- KEY (status),
- KEY (billing_address_id),
+ KEY (status) USING BTREE,
+ KEY USING BTREE (billing_address_id),
KEY (shipping_address_id),
KEY (member_id, store_id),
FOREIGN KEY (status) REFERENCES order_status(id) MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE,