| @@ 729-747 (lines=19) @@ | ||
| 726 | /** |
|
| 727 | * @inheritDoc |
|
| 728 | */ |
|
| 729 | public function hasIndex($tableName, $columns) |
|
| 730 | { |
|
| 731 | if (is_string($columns)) { |
|
| 732 | $columns = [$columns]; // str to array |
|
| 733 | } |
|
| 734 | ||
| 735 | $columns = array_map('strtolower', $columns); |
|
| 736 | $indexes = $this->getIndexes($tableName); |
|
| 737 | ||
| 738 | foreach ($indexes as $index) { |
|
| 739 | $a = array_diff($columns, $index['columns']); |
|
| 740 | ||
| 741 | if (empty($a)) { |
|
| 742 | return true; |
|
| 743 | } |
|
| 744 | } |
|
| 745 | ||
| 746 | return false; |
|
| 747 | } |
|
| 748 | ||
| 749 | /** |
|
| 750 | * @inheritDoc |
|
| @@ 656-669 (lines=14) @@ | ||
| 653 | /** |
|
| 654 | * @inheritDoc |
|
| 655 | */ |
|
| 656 | public function hasIndex($tableName, $columns) |
|
| 657 | { |
|
| 658 | if (is_string($columns)) { |
|
| 659 | $columns = [$columns]; |
|
| 660 | } |
|
| 661 | $indexes = $this->getIndexes($tableName); |
|
| 662 | foreach ($indexes as $index) { |
|
| 663 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 664 | return true; |
|
| 665 | } |
|
| 666 | } |
|
| 667 | ||
| 668 | return false; |
|
| 669 | } |
|
| 670 | ||
| 671 | /** |
|
| 672 | * @inheritDoc |
|
| @@ 571-587 (lines=17) @@ | ||
| 568 | /** |
|
| 569 | * @inheritDoc |
|
| 570 | */ |
|
| 571 | public function hasIndex($tableName, $columns) |
|
| 572 | { |
|
| 573 | if (is_string($columns)) { |
|
| 574 | $columns = [$columns]; // str to array |
|
| 575 | } |
|
| 576 | ||
| 577 | $columns = array_map('strtolower', $columns); |
|
| 578 | $indexes = $this->getIndexes($tableName); |
|
| 579 | ||
| 580 | foreach ($indexes as $index) { |
|
| 581 | if ($columns == $index['columns']) { |
|
| 582 | return true; |
|
| 583 | } |
|
| 584 | } |
|
| 585 | ||
| 586 | return false; |
|
| 587 | } |
|
| 588 | ||
| 589 | /** |
|
| 590 | * @inheritDoc |
|