| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 136 | public function execute(CapsuleInterface $capsule): void |
|
| 22 | { |
||
| 23 | 136 | $schema = $capsule->getSchema($this->getTable()); |
|
| 24 | 136 | $database = $this->database ?? '[default]'; |
|
|
|
|||
| 25 | |||
| 26 | 136 | if ($schema->exists()) { |
|
| 27 | 8 | throw new TableException( |
|
| 28 | 8 | "Unable to set primary keys for table '{$database}'.'{$this->getTable()}', table already exists" |
|
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | 136 | $schema->setPrimaryKeys($this->columns); |
|
| 33 | } |
||
| 35 |