Description
Description
We maintain a large CakePHP 4.4 application with many hundreds of thousands of lines of code. In recent years, we have increasingly moved towards a trunk-based development model, i.e.:
- we avoid long-lived branches;
- in-progress code is merged regularly into the main branch;
- feature flags are used to render in-progress features inert during development.
Overall, trunk-based development works well for us. However, the one problem we have with trunk-based development when using CakePHP relates to migrations.
Specifically, we want to be able to only run certain migrations if a related feature flag is enabled.
We have tried using feature flags within the up
/down
/change
methods themselves, but this does not work, because the migration itself is still marked as migrated once bin/cake migrations migrate
has been run. This leads to the migration not being run again when the feature flag is ultimately enabled.
Furthermore, it's not possible for us to override the Phinx Manager
class which contains the getMigrations
method, or the CakeManager
class which overrides it, as these classes are instantiated via the new
keyword. In other words, dependency injection is not used within the CakePHP framework code - it is tightly coupled to the concrete Manager
and CakeManager
classes.
Please could you consider providing a mechanism by which the behavior of the getMigrations()
method in CakeManager
can be modified/overridden/extended.
CakePHP Version
4.4