From aba3ebb669f6fb7cc9546e02fda3fffa7bb9681e Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Fri, 20 Oct 2023 11:54:46 -0500 Subject: [PATCH] Add getByBatch --- src/Sql/Migrator.php | 2 +- tests/Sql/MigratorTableTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Sql/Migrator.php b/src/Sql/Migrator.php index e783cc9..b617cf1 100644 --- a/src/Sql/Migrator.php +++ b/src/Sql/Migrator.php @@ -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']) ); } } diff --git a/tests/Sql/MigratorTableTest.php b/tests/Sql/MigratorTableTest.php index dd63597..1ad2d63 100644 --- a/tests/Sql/MigratorTableTest.php +++ b/tests/Sql/MigratorTableTest.php @@ -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(); }