| @@ 539-555 (lines=17) @@ | ||
| 536 | /** |
|
| 537 | * {@inheritdoc} |
|
| 538 | */ |
|
| 539 | public function hasIndex($tableName, $columns) |
|
| 540 | { |
|
| 541 | if (is_string($columns)) { |
|
| 542 | $columns = [$columns]; // str to array |
|
| 543 | } |
|
| 544 | ||
| 545 | $columns = array_map('strtolower', $columns); |
|
| 546 | $indexes = $this->getIndexes($tableName); |
|
| 547 | ||
| 548 | foreach ($indexes as $index) { |
|
| 549 | if ($columns == $index['columns']) { |
|
| 550 | return true; |
|
| 551 | } |
|
| 552 | } |
|
| 553 | ||
| 554 | return false; |
|
| 555 | } |
|
| 556 | ||
| 557 | /** |
|
| 558 | * {@inheritdoc} |
|
| @@ 638-651 (lines=14) @@ | ||
| 635 | /** |
|
| 636 | * {@inheritdoc} |
|
| 637 | */ |
|
| 638 | public function hasIndex($tableName, $columns) |
|
| 639 | { |
|
| 640 | if (is_string($columns)) { |
|
| 641 | $columns = [$columns]; |
|
| 642 | } |
|
| 643 | $indexes = $this->getIndexes($tableName); |
|
| 644 | foreach ($indexes as $index) { |
|
| 645 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 646 | return true; |
|
| 647 | } |
|
| 648 | } |
|
| 649 | ||
| 650 | return false; |
|
| 651 | } |
|
| 652 | ||
| 653 | /** |
|
| 654 | * {@inheritdoc} |
|
| @@ 707-725 (lines=19) @@ | ||
| 704 | /** |
|
| 705 | * {@inheritdoc} |
|
| 706 | */ |
|
| 707 | public function hasIndex($tableName, $columns) |
|
| 708 | { |
|
| 709 | if (is_string($columns)) { |
|
| 710 | $columns = [$columns]; // str to array |
|
| 711 | } |
|
| 712 | ||
| 713 | $columns = array_map('strtolower', $columns); |
|
| 714 | $indexes = $this->getIndexes($tableName); |
|
| 715 | ||
| 716 | foreach ($indexes as $index) { |
|
| 717 | $a = array_diff($columns, $index['columns']); |
|
| 718 | ||
| 719 | if (empty($a)) { |
|
| 720 | return true; |
|
| 721 | } |
|
| 722 | } |
|
| 723 | ||
| 724 | return false; |
|
| 725 | } |
|
| 726 | ||
| 727 | /** |
|
| 728 | * {@inheritdoc} |
|
| @@ 677-690 (lines=14) @@ | ||
| 674 | /** |
|
| 675 | * {@inheritdoc} |
|
| 676 | */ |
|
| 677 | public function hasIndex($tableName, $columns) |
|
| 678 | { |
|
| 679 | $columns = array_map('strtolower', (array)$columns); |
|
| 680 | $indexes = $this->getIndexes($tableName); |
|
| 681 | ||
| 682 | foreach ($indexes as $index) { |
|
| 683 | $a = array_diff($columns, $index['columns']); |
|
| 684 | if (empty($a)) { |
|
| 685 | return true; |
|
| 686 | } |
|
| 687 | } |
|
| 688 | ||
| 689 | return false; |
|
| 690 | } |
|
| 691 | ||
| 692 | /** |
|
| 693 | * {@inheritdoc} |
|