migrations
migrations copied to clipboard
Contain migration name in error if pending actions are still present
This is a (multiple allowed):
-
[ ] bug
-
[x] enhancement
-
[ ] feature-discussion (RFC)
-
CakePHP Version: 5.1.0-RC1
-
Migrations plugin version: 4.3.1
-
PHP Version: PHP 8.3.7
What you did
With the newest version of migrations it will throw an error if you have a migration which looks like this
$this->table('some_table')->drop();
because it should have actually been
$this->table('some_table')->drop()->save();
Expected Behavior
The error should contain the migration file which caused the error so its easier to debug, not just what you can see bellow
Actual Behavior
Could not apply migrations for {"plugin":"AlfredStaffMembers","connection":"test"}
Migrations failed to apply with message:
Migration has pending actions after execution!
Wouldnt it usually be the first one that is not yet "migrated"? But sure, if it is doable, having the actual file(name) included could really help.
In my case it wasn't a migration which wasn't applied yet to live but instead a phpunit run.
And since my DB schema is built with the migrator I rebuild the whole DB schema on each phpunit run and therefore execute all existing migrations in my app.
This has been fixed in both phinx backend as well as the new builtin backend.