| @@ 509-526 (lines=18) @@ | ||
| 506 | /** |
|
| 507 | * {@inheritdoc} |
|
| 508 | */ |
|
| 509 | public function hasIndex($tableName, $columns) |
|
| 510 | { |
|
| 511 | if (is_string($columns)) { |
|
| 512 | $columns = [$columns]; // str to array |
|
| 513 | } |
|
| 514 | ||
| 515 | $columns = array_map('strtolower', $columns); |
|
| 516 | $indexes = $this->getIndexes($tableName); |
|
| 517 | ||
| 518 | foreach ($indexes as $index) { |
|
| 519 | $a = array_diff($columns, $index['columns']); |
|
| 520 | if (empty($a)) { |
|
| 521 | return true; |
|
| 522 | } |
|
| 523 | } |
|
| 524 | ||
| 525 | return false; |
|
| 526 | } |
|
| 527 | ||
| 528 | /** |
|
| 529 | * {@inheritdoc} |
|
| @@ 634-652 (lines=19) @@ | ||
| 631 | /** |
|
| 632 | * {@inheritdoc} |
|
| 633 | */ |
|
| 634 | public function hasIndex($tableName, $columns) |
|
| 635 | { |
|
| 636 | if (is_string($columns)) { |
|
| 637 | $columns = [$columns]; // str to array |
|
| 638 | } |
|
| 639 | ||
| 640 | $columns = array_map('strtolower', $columns); |
|
| 641 | $indexes = $this->getIndexes($tableName); |
|
| 642 | ||
| 643 | foreach ($indexes as $index) { |
|
| 644 | $a = array_diff($columns, $index['columns']); |
|
| 645 | ||
| 646 | if (empty($a)) { |
|
| 647 | return true; |
|
| 648 | } |
|
| 649 | } |
|
| 650 | ||
| 651 | return false; |
|
| 652 | } |
|
| 653 | ||
| 654 | /** |
|
| 655 | * {@inheritdoc} |
|
| @@ 535-548 (lines=14) @@ | ||
| 532 | /** |
|
| 533 | * {@inheritdoc} |
|
| 534 | */ |
|
| 535 | public function hasIndex($tableName, $columns) |
|
| 536 | { |
|
| 537 | if (is_string($columns)) { |
|
| 538 | $columns = [$columns]; |
|
| 539 | } |
|
| 540 | $columns = array_map('strtolower', $columns); |
|
| 541 | $indexes = $this->getIndexes($tableName); |
|
| 542 | foreach ($indexes as $index) { |
|
| 543 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 544 | return true; |
|
| 545 | } |
|
| 546 | } |
|
| 547 | ||
| 548 | return false; |
|
| 549 | } |
|
| 550 | ||
| 551 | /** |
|