@@ 715-733 (lines=19) @@ | ||
712 | /** |
|
713 | * {@inheritdoc} |
|
714 | */ |
|
715 | public function hasIndex($tableName, $columns) |
|
716 | { |
|
717 | if (is_string($columns)) { |
|
718 | $columns = [$columns]; // str to array |
|
719 | } |
|
720 | ||
721 | $columns = array_map('strtolower', $columns); |
|
722 | $indexes = $this->getIndexes($tableName); |
|
723 | ||
724 | foreach ($indexes as $index) { |
|
725 | $a = array_diff($columns, $index['columns']); |
|
726 | ||
727 | if (empty($a)) { |
|
728 | return true; |
|
729 | } |
|
730 | } |
|
731 | ||
732 | return false; |
|
733 | } |
|
734 | ||
735 | /** |
|
736 | * {@inheritdoc} |
@@ 649-662 (lines=14) @@ | ||
646 | /** |
|
647 | * {@inheritdoc} |
|
648 | */ |
|
649 | public function hasIndex($tableName, $columns) |
|
650 | { |
|
651 | if (is_string($columns)) { |
|
652 | $columns = [$columns]; |
|
653 | } |
|
654 | $indexes = $this->getIndexes($tableName); |
|
655 | foreach ($indexes as $index) { |
|
656 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
657 | return true; |
|
658 | } |
|
659 | } |
|
660 | ||
661 | return false; |
|
662 | } |
|
663 | ||
664 | /** |
|
665 | * {@inheritdoc} |
@@ 566-582 (lines=17) @@ | ||
563 | /** |
|
564 | * {@inheritdoc} |
|
565 | */ |
|
566 | public function hasIndex($tableName, $columns) |
|
567 | { |
|
568 | if (is_string($columns)) { |
|
569 | $columns = [$columns]; // str to array |
|
570 | } |
|
571 | ||
572 | $columns = array_map('strtolower', $columns); |
|
573 | $indexes = $this->getIndexes($tableName); |
|
574 | ||
575 | foreach ($indexes as $index) { |
|
576 | if ($columns == $index['columns']) { |
|
577 | return true; |
|
578 | } |
|
579 | } |
|
580 | ||
581 | return false; |
|
582 | } |
|
583 | ||
584 | /** |
|
585 | * {@inheritdoc} |