Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| CreateMigrationsTable | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
2 / 2 |
n/a |
0 / 0 |
n/a |
0 / 0 |
|
100.00% |
1 / 1 |
1 | |||||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celema\Quma\Commands; |
| 6 | |
| 7 | use Celema\Console\Command; |
| 8 | use Celema\Console\Io; |
| 9 | use Celema\Console\Opt; |
| 10 | use Celema\Quma\Connection; |
| 11 | use Celema\Quma\Environment; |
| 12 | use Celema\Quma\Migrations\MetadataTable; |
| 13 | |
| 14 | #[Command('db:create-migrations-table', 'Creates a migrations table', group: 'Database')] |
| 15 | final class CreateMigrationsTable |
| 16 | { |
| 17 | /** |
| 18 | * @param array<non-empty-string, Connection>|Connection $connections |
| 19 | * @param array<array-key, mixed> $options |
| 20 | */ |
| 21 | public function __construct( |
| 22 | private readonly array|Connection $connections, |
| 23 | private readonly array $options = [], |
| 24 | ) {} |
| 25 | |
| 26 | public function __invoke( |
| 27 | Io $io, |
| 28 | #[Opt('Connection to use', value: 'name')] |
| 29 | string $conn = 'default', |
| 30 | #[Opt('Show stack traces for failing table creation')] |
| 31 | bool $stacktrace = false, |
| 32 | ): int { |
| 33 | $env = new Environment($this->connections, $this->options, $conn, $stacktrace); |
| 34 | |
| 35 | return new MetadataTable($env, $io)->create($env->db); |
| 36 | } |
| 37 | } |