Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
24 | 24 | public function execute(CapsuleInterface $capsule): void |
|
25 | { |
||
26 | 24 | $schema = $capsule->getSchema($this->getTable()); |
|
27 | |||
28 | 24 | if (!$schema->hasIndex($this->columns)) { |
|
29 | 8 | $columns = implode(',', $this->columns); |
|
30 | 8 | throw new IndexException( |
|
31 | 8 | "Unable to alter index '{$schema->getName()}'.({$columns}), no such index" |
|
32 | ); |
||
33 | } |
||
34 | |||
35 | 16 | $schema->index($this->columns)->unique( |
|
36 | 16 | $this->getOption('unique', false) |
|
37 | ); |
||
40 |