| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function execute(CapsuleInterface $capsule): void |
||
| 25 | { |
||
| 26 | $schema = $capsule->getSchema($this->getTable()); |
||
| 27 | $database = $this->database ?? '[default]'; |
||
|
|
|||
| 28 | |||
| 29 | if ($schema->exists()) { |
||
| 30 | throw new TableException( |
||
| 31 | "Unable to create table '{$database}'.'{$this->getTable()}', table already exists" |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | if (empty($schema->getColumns())) { |
||
| 36 | throw new TableException( |
||
| 37 | "Unable to create table '{$database}'.'{$this->getTable()}', no columns were added" |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 41 | $schema->save(HandlerInterface::DO_ALL); |
||
| 42 | } |
||
| 44 |