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