Skip to content

Commit

Permalink
Add getByBatch
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Oct 20, 2023
1 parent 17ad171 commit aba3ebb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Sql/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public function getByBatch(string|int $batch): array
$class = $this->getTable();
if (!empty($class)) {
$batchMigrations = array_values(
$class::findBy(['batch' => $batch], ['order' => 'migration_id DESC'])->toArray('migration_id')
$class::findBy(['batch' => $batch], ['order' => 'migration_id DESC'])->toArray(['column' => 'migration_id'])
);
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/Sql/MigratorTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function testRun()
$this->assertFalse($this->db->hasTable('test_users'));
$migrator->runAll();
$this->assertTrue($this->db->hasTable('test_users'));
$this->assertCount(1, $migrator->getByBatch('batch-1'));
$this->db->disconnect();
}

Expand Down

0 comments on commit aba3ebb

Please sign in to comment.