| @@ 635-653 (lines=19) @@ | ||
| 632 | /** | |
| 633 |      * {@inheritdoc} | |
| 634 | */ | |
| 635 | public function hasIndex($tableName, $columns) | |
| 636 |     { | |
| 637 |         if (is_string($columns)) { | |
| 638 | $columns = [$columns]; // str to array | |
| 639 | } | |
| 640 | ||
| 641 |         $columns = array_map('strtolower', $columns); | |
| 642 | $indexes = $this->getIndexes($tableName); | |
| 643 | ||
| 644 |         foreach ($indexes as $index) { | |
| 645 | $a = array_diff($columns, $index['columns']); | |
| 646 | ||
| 647 |             if (empty($a)) { | |
| 648 | return true; | |
| 649 | } | |
| 650 | } | |
| 651 | ||
| 652 | return false; | |
| 653 | } | |
| 654 | ||
| 655 | /** | |
| 656 |      * {@inheritdoc} | |
| @@ 524-541 (lines=18) @@ | ||
| 521 | /** | |
| 522 |      * {@inheritdoc} | |
| 523 | */ | |
| 524 | public function hasIndex($tableName, $columns) | |
| 525 |     { | |
| 526 |         if (is_string($columns)) { | |
| 527 | $columns = [$columns]; // str to array | |
| 528 | } | |
| 529 | ||
| 530 |         $columns = array_map('strtolower', $columns); | |
| 531 | $indexes = $this->getIndexes($tableName); | |
| 532 | ||
| 533 |         foreach ($indexes as $index) { | |
| 534 | $a = array_diff($columns, $index['columns']); | |
| 535 |             if (empty($a)) { | |
| 536 | return true; | |
| 537 | } | |
| 538 | } | |
| 539 | ||
| 540 | return false; | |
| 541 | } | |
| 542 | ||
| 543 | /** | |
| 544 |      * {@inheritdoc} | |
| @@ 557-570 (lines=14) @@ | ||
| 554 | /** | |
| 555 |      * {@inheritdoc} | |
| 556 | */ | |
| 557 | public function hasIndex($tableName, $columns) | |
| 558 |     { | |
| 559 |         if (is_string($columns)) { | |
| 560 | $columns = [$columns]; | |
| 561 | } | |
| 562 |         $columns = array_map('strtolower', $columns); | |
| 563 | $indexes = $this->getIndexes($tableName); | |
| 564 |         foreach ($indexes as $index) { | |
| 565 |             if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { | |
| 566 | return true; | |
| 567 | } | |
| 568 | } | |
| 569 | ||
| 570 | return false; | |
| 571 | } | |
| 572 | ||
| 573 | /** | |