| @@ 503-519 (lines=17) @@ | ||
| 500 | /** |
|
| 501 | * {@inheritdoc} |
|
| 502 | */ |
|
| 503 | public function hasIndex($tableName, $columns) |
|
| 504 | { |
|
| 505 | if (is_string($columns)) { |
|
| 506 | $columns = [$columns]; // str to array |
|
| 507 | } |
|
| 508 | ||
| 509 | $columns = array_map('strtolower', $columns); |
|
| 510 | $indexes = $this->getIndexes($tableName); |
|
| 511 | ||
| 512 | foreach ($indexes as $index) { |
|
| 513 | if ($columns == $index['columns']) { |
|
| 514 | return true; |
|
| 515 | } |
|
| 516 | } |
|
| 517 | ||
| 518 | return false; |
|
| 519 | } |
|
| 520 | ||
| 521 | /** |
|
| 522 | * {@inheritdoc} |
|
| @@ 548-560 (lines=13) @@ | ||
| 545 | /** |
|
| 546 | * {@inheritdoc} |
|
| 547 | */ |
|
| 548 | public function hasIndex($tableName, $columns) |
|
| 549 | { |
|
| 550 | if (is_string($columns)) { |
|
| 551 | $columns = [$columns]; |
|
| 552 | } |
|
| 553 | $indexes = $this->getIndexes($tableName); |
|
| 554 | foreach ($indexes as $index) { |
|
| 555 | if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { |
|
| 556 | return true; |
|
| 557 | } |
|
| 558 | } |
|
| 559 | ||
| 560 | return false; |
|
| 561 | } |
|
| 562 | ||
| 563 | /** |
|