Database.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Plugin\Install; |
| 6 | |
| 7 | use AC; |
| 8 | |
| 9 | final class Database implements AC\Plugin\Install |
| 10 | { |
| 11 | private AC\Storage\Table $table; |
| 12 | |
| 13 | public function __construct(AC\Storage\Table $table) |
| 14 | { |
| 15 | $this->table = $table; |
| 16 | } |
| 17 | |
| 18 | public function install(): void |
| 19 | { |
| 20 | if (! $this->table->exists()) { |
| 21 | $this->table->create(); |
| 22 | } else { |
| 23 | $this->table->update(); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | } |
| 28 |