Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function execute(CapsuleInterface $capsule): void |
||
15 | { |
||
16 | $schema = $capsule->getSchema($this->getTable()); |
||
17 | $database = $this->database ?? '[default]'; |
||
|
|||
18 | |||
19 | if (!$schema->exists()) { |
||
20 | throw new TableException( |
||
21 | "Unable to truncate table '{$database}'.'{$this->getTable()}', table does not exists" |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | $capsule->getDatabase()->execute(sprintf('TRUNCATE `%s`', $this->getTable())); |
||
26 | } |
||
28 |