New Backend
As of migrations 4.3. there is a new migrations backend that uses CakePHP's database abstractions and ORM. Longer term this will allow for phinx to be removed as a dependency. Reducing the dependencies of migrations helps keep your applications dependencies smaller. Migrations can also benefit from improvements in the ORM with less lag time as they no longer need to be re-implemented in phinx. Lastly, it streamlines the number of APIs you have to learn. Migrations included APIs that are very different from CakePHPs, and we can now align querying and data manipulation APIs so that you don't have to remember two different APIs depending on the context.
What is the same?
Your migrations shouldn't have to change much to adapt to the new backend. The migrations backend implements all of the phinx interfaces and can run migrations based on phinx classes. If your migrations fail for a reason not outlined below please open an issue.
What is different?
If your migrations are using the AdapterInterface
to fetch rows or update rows you will need to update your code. If you use Adapter::query()
to execute queries, the return of this method is now Cake\Database\StatementInterface
instead. This impacts fetchAll()
, and fetch()
.
Enabling the new backend
The new backend can be enabled through application configuration. Add the following to your config/app.php
::
return [
// Other configuration.
'Migrations' => ['backend' => 'builtin'],
];
If your migrations have problems running with the builtin backend, removing this configuration option will revert to using phinx.
Summary of pull requests
- Get started on PhinxAdapter by @markstory in #679
- Get Environment tests passing with migrations engine by @markstory in #682
- Get manager tests passing with new backend by @markstory in #684
- Import Config and wire it into Manager and Environment by @markstory in #685
- Add config switch for backend selection. by @markstory in #686
- Start implementing commands using builtin backend by @markstory in #688
- Trim down Config and Manager classes to remove unused behavior by @markstory in #689
- Update to use cake connections pt1 by @markstory in #690
- Update Adapter classes to use Connection pt1 by @markstory in #694
- Remove Symfony/Console from Manager and Adapter by @markstory in #695
- Add new Migrate command by @markstory in #697
- Add Dump command for new backend by @markstory in #698
- Add schema lock file generation to migrate command by @markstory in #699
- Add Mark migrated command by @markstory in #700
- Add rollback command by @markstory in #701
- Expand test coverage for migration events. by @markstory in #702
- Add seed command by @markstory in #703
- Add
migrations create
alias with new backend by @markstory in #704 - Add docs on the intended upgrade process. by @markstory in #705
- Migrations builtin backend by @markstory in #706
- Convert FeatureFlags to Configure operations by @markstory in #707
- Add test covering mark_migrated and plugins by @markstory in #709
- Add
migrations --help
command by @markstory in #710 - Align postgres build config with no-phinx by @markstory in #712
- 696 - Fix table method to add the table to array as phinx does by @ajibarra in #711
- Cleanup by @markstory in #713
- Merge in 'builtin' backend to 4.x by @markstory in #714
Full Changelog: 4.2.0...4.3.0