Skip to content

Commit

Permalink
fix: migration always use latest batch instead using take (#397)
Browse files Browse the repository at this point in the history
- remove `take` option from running migration
  • Loading branch information
SonyPradana authored Oct 13, 2024
1 parent 433c45d commit 5d3d0df
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/System/Integrate/Console/MigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function printHelp()
'database:show' => 'Show database table',
],
'options' => [
'--take' => 'Number of migrations to be run.',
'--take' => 'Limit of migrations to be run.',
'--batch' => 'Batch migration excution.',
'--dry-run' => 'Excute migration but olny get query output.',
'--force' => 'Force runing migration/database query in production.',
Expand All @@ -105,7 +105,7 @@ public function printHelp()
'--yes' => 'Accept it without having it ask any questions',
],
'relation' => [
'migrate' => ['--take', '--seed', '--dry-run', '--force'],
'migrate' => ['--seed', '--dry-run', '--force'],
'migrate:fresh' => ['--seed', '--dry-run', '--force'],
'migrate:reset' => ['--dry-run', '--force'],
'migrate:refresh' => ['--seed', '--dry-run', '--force'],
Expand Down Expand Up @@ -235,9 +235,8 @@ public function migration(bool $silent = false): int
$width = $this->getWidth(40, 60);
$batch = false;
$migrate = $this->baseMigrate($batch);
$take = $this->option('take', $batch);
$migrate
->filter(static fn ($value): bool => $value['batch'] >= $batch - $take)
->filter(static fn ($value): bool => $value['batch'] == $batch)
->sort();

$print->tap(info('Running migration'));
Expand Down

0 comments on commit 5d3d0df

Please sign in to comment.