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