| @@ 585-601 (lines=17) @@ | ||
| 582 | /** |
|
| 583 | * {@inheritdoc} |
|
| 584 | */ |
|
| 585 | public function hasIndex($tableName, $columns) |
|
| 586 | { |
|
| 587 | if (is_string($columns)) { |
|
| 588 | $columns = [$columns]; // str to array |
|
| 589 | } |
|
| 590 | ||
| 591 | $columns = array_map('strtolower', $columns); |
|
| 592 | $indexes = $this->getIndexes($tableName); |
|
| 593 | ||
| 594 | foreach ($indexes as $index) { |
|
| 595 | if ($columns == $index['columns']) { |
|
| 596 | return true; |
|
| 597 | } |
|
| 598 | } |
|
| 599 | ||
| 600 | return false; |
|
| 601 | } |
|
| 602 | ||
| 603 | /** |
|
| 604 | * {@inheritdoc} |
|
| @@ 669-682 (lines=14) @@ | ||
| 666 | /** |
|
| 667 | * {@inheritdoc} |
|
| 668 | */ |
|
| 669 | public function hasIndex($tableName, $columns) |
|
| 670 | { |
|
| 671 | if (is_string($columns)) { |
|
| 672 | $columns = [$columns]; |
|
| 673 | } |
|
| 674 | $indexes = $this->getIndexes($tableName); |
|
| 675 | foreach ($indexes as $index) { |
|
| 676 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 677 | return true; |
|
| 678 | } |
|
| 679 | } |
|
| 680 | ||
| 681 | return false; |
|
| 682 | } |
|
| 683 | ||
| 684 | /** |
|
| 685 | * {@inheritdoc} |
|
| @@ 662-679 (lines=18) @@ | ||
| 659 | /** |
|
| 660 | * {@inheritdoc} |
|
| 661 | */ |
|
| 662 | public function hasIndex($tableName, $columns) |
|
| 663 | { |
|
| 664 | if (is_string($columns)) { |
|
| 665 | $columns = [$columns]; // str to array |
|
| 666 | } |
|
| 667 | ||
| 668 | $columns = array_map('strtolower', $columns); |
|
| 669 | $indexes = $this->getIndexes($tableName); |
|
| 670 | ||
| 671 | foreach ($indexes as $index) { |
|
| 672 | $a = array_diff($columns, $index['columns']); |
|
| 673 | if (empty($a)) { |
|
| 674 | return true; |
|
| 675 | } |
|
| 676 | } |
|
| 677 | ||
| 678 | return false; |
|
| 679 | } |
|
| 680 | ||
| 681 | /** |
|
| 682 | * {@inheritdoc} |
|
| @@ 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} |
|