@@ 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 |
@@ 552-568 (lines=17) @@ | ||
549 | /** |
|
550 | * @inheritDoc |
|
551 | */ |
|
552 | public function hasIndex($tableName, $columns) |
|
553 | { |
|
554 | if (is_string($columns)) { |
|
555 | $columns = [$columns]; // str to array |
|
556 | } |
|
557 | ||
558 | $columns = array_map('strtolower', $columns); |
|
559 | $indexes = $this->getIndexes($tableName); |
|
560 | ||
561 | foreach ($indexes as $index) { |
|
562 | if ($columns == $index['columns']) { |
|
563 | return true; |
|
564 | } |
|
565 | } |
|
566 | ||
567 | return false; |
|
568 | } |
|
569 | ||
570 | /** |
|
571 | * @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 |