From the above, it is clear that CreateTable, DropTable, AddColumnToTable, RemoveColumnFromTable and AlterTable patterns are predefined. If command doesn’t match any predefined format, blank migration file will be created, so you should add necessary procedure.
migration_snapshot
php bin/cake.php bake migration_snapshot snapshot_name generate a snapshot of table schemes as migration code.
Adding option require-table, generate snapshot for only tables with Table class. As default, generate snapshot for tables in the database.
It is clear if you try. Or, reading Template/Bake/config/snapshot.php helps your understanding.
Command available in migrations
Let’s see command used in the following.
PHP
1
php bin/cake.php migrations COMMAND
It is defined by files in Command directory.
migrate
Execute migration. Specify migration version with target option, and only the specified version will be migrated.
rollback
Rollback the last executed migration or specified migration with target option.
status
List migrations with status which reveals being already migrated or not.
mark_migrated
Make migration with given version as executed.
Shell
1
php bin/cake.phpmigrations mark_migrated VERSION
Migration of CakePHP 3 is wrapper of phinx, so we should look into phinx to understand detail. It is really difficult.