Skip to content

Commit e0262c0

Browse files
sebastien-fauvelgreenlion
authored andcommitted
Fixed identification of unique indexes (#300)
Unique indexes, excepted the first index in the list, were wrongly identified as non-unique.
1 parent 28ff145 commit e0262c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PHPSQLParser/processors/CreateDefinitionProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function process($tokens) {
155155
break;
156156

157157
case 'UNIQUE':
158-
if ($prevCategory === '' || $prevCategory === 'CONSTRAINT') {
158+
if ($prevCategory === '' || $prevCategory === 'CONSTRAINT' || $prevCategory === 'INDEX_COL_LIST') {
159159
// next one is KEY
160160
$expr[] = array('expr_type' => ExpressionType::UNIQUE_IDX, 'base_expr' => $trim);
161161
$currCategory = $upper;
@@ -415,4 +415,4 @@ public function process($tokens) {
415415
return $result;
416416
}
417417
}
418-
?>
418+
?>

0 commit comments

Comments
 (0)