Cakephp 4.2 | Migrations Diff

We have a large DB (old phpBB forum), which we now want to turn into a modern discussion platform.

We want to start with migrations, 68 tables we want to rename, ie remove the prefix. All actions around the database are first performed in SequlPro. We want to create a migration file for each change or group of changes. For these tasks we usually successfully use the migration_diff command, but mostly these are projects where we work from scratch, and where there is no data.

Now we have a problem. We are unable to create the correct migration files with migration_diff. Instead of rename tables we get the creation / deletion of the same.

What we do:

  • After importing a 4gb heavy database, we create the initial migration with migration_snapshot
  • in SequlPro we change the name of one or more db tables, we start migration_diff, we get creation and deletion of tables, instead of rename functions. The same result is if we change the field name.

I’ve been using CakePHP for a long time, but I don’t remember having a problem like this. What are we to do? How is it right to start with such migrations?

  • MariaDB 10.2
  • CakePHP 4.2.10 fresh install
  • we try in PHP 7.4, 8.0, 8.1