| @@ 530-543 (lines=14) @@ | ||
| 527 | /** |
|
| 528 | * {@inheritdoc} |
|
| 529 | */ |
|
| 530 | public function hasIndex($tableName, $columns) |
|
| 531 | { |
|
| 532 | if (is_string($columns)) { |
|
| 533 | $columns = [$columns]; |
|
| 534 | } |
|
| 535 | $columns = array_map('strtolower', $columns); |
|
| 536 | $indexes = $this->getIndexes($tableName); |
|
| 537 | foreach ($indexes as $index) { |
|
| 538 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 539 | return true; |
|
| 540 | } |
|
| 541 | } |
|
| 542 | ||
| 543 | return false; |
|
| 544 | } |
|
| 545 | ||
| 546 | /** |
|
| @@ 520-537 (lines=18) @@ | ||
| 517 | /** |
|
| 518 | * {@inheritdoc} |
|
| 519 | */ |
|
| 520 | public function hasIndex($tableName, $columns) |
|
| 521 | { |
|
| 522 | if (is_string($columns)) { |
|
| 523 | $columns = [$columns]; // str to array |
|
| 524 | } |
|
| 525 | ||
| 526 | $columns = array_map('strtolower', $columns); |
|
| 527 | $indexes = $this->getIndexes($tableName); |
|
| 528 | ||
| 529 | foreach ($indexes as $index) { |
|
| 530 | $a = array_diff($columns, $index['columns']); |
|
| 531 | if (empty($a)) { |
|
| 532 | return true; |
|
| 533 | } |
|
| 534 | } |
|
| 535 | ||
| 536 | return false; |
|
| 537 | } |
|
| 538 | ||
| 539 | /** |
|
| 540 | * {@inheritdoc} |
|
| @@ 644-662 (lines=19) @@ | ||
| 641 | /** |
|
| 642 | * {@inheritdoc} |
|
| 643 | */ |
|
| 644 | public function hasIndex($tableName, $columns) |
|
| 645 | { |
|
| 646 | if (is_string($columns)) { |
|
| 647 | $columns = [$columns]; // str to array |
|
| 648 | } |
|
| 649 | ||
| 650 | $columns = array_map('strtolower', $columns); |
|
| 651 | $indexes = $this->getIndexes($tableName); |
|
| 652 | ||
| 653 | foreach ($indexes as $index) { |
|
| 654 | $a = array_diff($columns, $index['columns']); |
|
| 655 | ||
| 656 | if (empty($a)) { |
|
| 657 | return true; |
|
| 658 | } |
|
| 659 | } |
|
| 660 | ||
| 661 | return false; |
|
| 662 | } |
|
| 663 | ||
| 664 | /** |
|
| 665 | * {@inheritdoc} |
|