Skip to content

Commit f0455ed

Browse files
committed
wip
1 parent 474326d commit f0455ed

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Tempest/Framework/Commands/MigrateValidateCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Tempest\Framework\Commands;
66

77
use Tempest\Console\Console;
8+
use Tempest\Console\ConsoleArgument;
89
use Tempest\Console\ConsoleCommand;
910
use Tempest\Console\ExitCode;
1011
use Tempest\Container\Singleton;
@@ -28,10 +29,13 @@ public function __construct(
2829
name: 'migrate:validate',
2930
description: 'Validates the integrity of existing migration files by checking if they have been tampered with.',
3031
)]
31-
public function __invoke(): ExitCode
32+
public function __invoke(
33+
#[ConsoleArgument(description: 'Use a specific database.')]
34+
?string $database = null
35+
): ExitCode
3236
{
3337
$this->console->header('Validating migration files');
34-
$this->migrationManager->validate();
38+
$this->migrationManager->onDatabase($database)->validate();
3539

3640
if (! $this->validationPassed) {
3741
$this->console->writeln();

tests/Integration/Database/MultiDatabaseTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,11 @@ public function test_migrate_down_command(): void
233233
fn () => $this->assertTrue(query(Migration::class)->count()->onDatabase('backup')->execute() > 0),
234234
);
235235
}
236+
237+
public function test_migrate_validate_command(): void
238+
{
239+
$this->console
240+
->call('migrate:validate --database=main')
241+
->assertSuccess();
242+
}
236243
}

0 commit comments

Comments
 (0)