| @@ 487-503 (lines=17) @@ | ||
| 484 | /** |
|
| 485 | * {@inheritdoc} |
|
| 486 | */ |
|
| 487 | public function hasIndex($tableName, $columns) |
|
| 488 | { |
|
| 489 | if (is_string($columns)) { |
|
| 490 | $columns = [$columns]; // str to array |
|
| 491 | } |
|
| 492 | ||
| 493 | $columns = array_map('strtolower', $columns); |
|
| 494 | $indexes = $this->getIndexes($tableName); |
|
| 495 | ||
| 496 | foreach ($indexes as $index) { |
|
| 497 | if ($columns == $index['columns']) { |
|
| 498 | return true; |
|
| 499 | } |
|
| 500 | } |
|
| 501 | ||
| 502 | return false; |
|
| 503 | } |
|
| 504 | ||
| 505 | /** |
|
| 506 | * {@inheritdoc} |
|
| @@ 581-594 (lines=14) @@ | ||
| 578 | /** |
|
| 579 | * {@inheritdoc} |
|
| 580 | */ |
|
| 581 | public function hasIndex($tableName, $columns) |
|
| 582 | { |
|
| 583 | if (is_string($columns)) { |
|
| 584 | $columns = [$columns]; |
|
| 585 | } |
|
| 586 | $indexes = $this->getIndexes($tableName); |
|
| 587 | foreach ($indexes as $index) { |
|
| 588 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 589 | return true; |
|
| 590 | } |
|
| 591 | } |
|
| 592 | ||
| 593 | return false; |
|
| 594 | } |
|
| 595 | ||
| 596 | /** |
|
| 597 | * {@inheritdoc} |
|
| @@ 656-674 (lines=19) @@ | ||
| 653 | /** |
|
| 654 | * {@inheritdoc} |
|
| 655 | */ |
|
| 656 | public function hasIndex($tableName, $columns) |
|
| 657 | { |
|
| 658 | if (is_string($columns)) { |
|
| 659 | $columns = [$columns]; // str to array |
|
| 660 | } |
|
| 661 | ||
| 662 | $columns = array_map('strtolower', $columns); |
|
| 663 | $indexes = $this->getIndexes($tableName); |
|
| 664 | ||
| 665 | foreach ($indexes as $index) { |
|
| 666 | $a = array_diff($columns, $index['columns']); |
|
| 667 | ||
| 668 | if (empty($a)) { |
|
| 669 | return true; |
|
| 670 | } |
|
| 671 | } |
|
| 672 | ||
| 673 | return false; |
|
| 674 | } |
|
| 675 | ||
| 676 | /** |
|
| 677 | * {@inheritdoc} |
|
| @@ 602-619 (lines=18) @@ | ||
| 599 | /** |
|
| 600 | * {@inheritdoc} |
|
| 601 | */ |
|
| 602 | public function hasIndex($tableName, $columns) |
|
| 603 | { |
|
| 604 | if (is_string($columns)) { |
|
| 605 | $columns = [$columns]; // str to array |
|
| 606 | } |
|
| 607 | ||
| 608 | $columns = array_map('strtolower', $columns); |
|
| 609 | $indexes = $this->getIndexes($tableName); |
|
| 610 | ||
| 611 | foreach ($indexes as $index) { |
|
| 612 | $a = array_diff($columns, $index['columns']); |
|
| 613 | if (empty($a)) { |
|
| 614 | return true; |
|
| 615 | } |
|
| 616 | } |
|
| 617 | ||
| 618 | return false; |
|
| 619 | } |
|
| 620 | ||
| 621 | /** |
|
| 622 | * {@inheritdoc} |
|