| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function execute(CapsuleInterface $capsule): void |
||
| 37 | { |
||
| 38 | $schema = $capsule->getSchema($this->getTable()); |
||
| 39 | |||
| 40 | if ($schema->hasIndex($this->columns)) { |
||
| 41 | $columns = implode(',', $this->columns); |
||
| 42 | throw new IndexException( |
||
| 43 | "Unable to create index '{$schema->getName()}'.({$columns}), index already exists" |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | $schema->index($this->columns)->unique( |
||
| 48 | $this->getOption('unique', false) |
||
| 49 | ); |
||
| 50 | |||
| 51 | if ($this->hasOption('name')) { |
||
| 52 | $schema->index($this->columns)->setName($this->getOption('name')); |
||
| 53 | } |
||
| 56 |