migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Contain migration name in error if pending actions are still present

Open LordSimal opened this issue 1 year ago • 2 comments
trafficstars

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!

LordSimal avatar May 21 '24 20:05 LordSimal

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.

dereuromark avatar May 21 '24 21:05 dereuromark

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.

LordSimal avatar May 22 '24 07:05 LordSimal

This has been fixed in both phinx backend as well as the new builtin backend.

LordSimal avatar Dec 26 '24 20:12 LordSimal