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