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