| @@ 521-538 (lines=18) @@ | ||
| 518 | /** |
|
| 519 | * {@inheritdoc} |
|
| 520 | */ |
|
| 521 | public function hasIndex($tableName, $columns) |
|
| 522 | { |
|
| 523 | if (is_string($columns)) { |
|
| 524 | $columns = [$columns]; // str to array |
|
| 525 | } |
|
| 526 | ||
| 527 | $columns = array_map('strtolower', $columns); |
|
| 528 | $indexes = $this->getIndexes($tableName); |
|
| 529 | ||
| 530 | foreach ($indexes as $index) { |
|
| 531 | $a = array_diff($columns, $index['columns']); |
|
| 532 | if (empty($a)) { |
|
| 533 | return true; |
|
| 534 | } |
|
| 535 | } |
|
| 536 | ||
| 537 | return false; |
|
| 538 | } |
|
| 539 | ||
| 540 | /** |
|
| 541 | * {@inheritdoc} |
|
| @@ 640-658 (lines=19) @@ | ||
| 637 | /** |
|
| 638 | * {@inheritdoc} |
|
| 639 | */ |
|
| 640 | public function hasIndex($tableName, $columns) |
|
| 641 | { |
|
| 642 | if (is_string($columns)) { |
|
| 643 | $columns = [$columns]; // str to array |
|
| 644 | } |
|
| 645 | ||
| 646 | $columns = array_map('strtolower', $columns); |
|
| 647 | $indexes = $this->getIndexes($tableName); |
|
| 648 | ||
| 649 | foreach ($indexes as $index) { |
|
| 650 | $a = array_diff($columns, $index['columns']); |
|
| 651 | ||
| 652 | if (empty($a)) { |
|
| 653 | return true; |
|
| 654 | } |
|
| 655 | } |
|
| 656 | ||
| 657 | return false; |
|
| 658 | } |
|
| 659 | ||
| 660 | /** |
|
| 661 | * {@inheritdoc} |
|
| @@ 531-544 (lines=14) @@ | ||
| 528 | /** |
|
| 529 | * {@inheritdoc} |
|
| 530 | */ |
|
| 531 | public function hasIndex($tableName, $columns) |
|
| 532 | { |
|
| 533 | if (is_string($columns)) { |
|
| 534 | $columns = [$columns]; |
|
| 535 | } |
|
| 536 | $columns = array_map('strtolower', $columns); |
|
| 537 | $indexes = $this->getIndexes($tableName); |
|
| 538 | foreach ($indexes as $index) { |
|
| 539 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 540 | return true; |
|
| 541 | } |
|
| 542 | } |
|
| 543 | return false; |
|
| 544 | } |
|
| 545 | ||
| 546 | /** |
|
| 547 | * {@inheritdoc} |
|