Skip to content

Commit 5830da2

Browse files
authoredJun 10, 2024
Add migration version and name to pending actions error (#2289)
1 parent ef38e41 commit 5830da2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/Phinx/Migration/AbstractMigration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function postFlightCheck(): void
358358
{
359359
foreach ($this->tables as $table) {
360360
if ($table->hasPendingActions()) {
361-
throw new RuntimeException('Migration has pending actions after execution!');
361+
throw new RuntimeException(sprintf('Migration %s_%s has pending actions after execution!', $this->getVersion(), $this->getName()));
362362
}
363363
}
364364
}

‎tests/Phinx/Migration/AbstractMigrationTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function testTableMethod()
265265
public function testPostFlightCheckFail()
266266
{
267267
// stub migration
268-
$migrationStub = $this->getMockForAbstractClass('\Phinx\Migration\AbstractMigration', ['mockenv', 20230102030405]);
268+
$migrationStub = $this->getMockForAbstractClass('\Phinx\Migration\AbstractMigration', ['mockenv', 20230102030405], 'PostFlightCheck');
269269

270270
$adapterStub = $this->getMockBuilder('\Phinx\Db\Adapter\MysqlAdapter')
271271
->setConstructorArgs([[]])
@@ -280,7 +280,7 @@ public function testPostFlightCheckFail()
280280
$table->addColumn('column1', 'integer', ['null' => true]);
281281

282282
$this->expectException(RuntimeException::class);
283-
$this->expectExceptionMessage('Migration has pending actions after execution!');
283+
$this->expectExceptionMessage('Migration 20230102030405_PostFlightCheck has pending actions after execution!');
284284

285285
$migrationStub->postFlightCheck();
286286
}

0 commit comments

Comments
 (0)