From 6.0.15, migrations are part of the kernel. A migration is a file that changes an installation in a repeatable way: a new content class, a setting, a batch of data. Exponential records which migrations ran, so each runs once on each installation.
Files
Names start with a timestamp: YYYYMMDDHHMMSS_name.type. Types are php, yml, sql, an engine-specific sql, mongodb.json and ini. Exponential reads them from the site's migrations/ folder, from extension/<name>/migrations/ of every active extension, and from installed packages.
A first migration
./console exp:migration:generate --skeleton add_news_class --apply ./console exp:migration:check ./console exp:migration:migrate # dry run ./console exp:migration:migrate --apply ./console exp:migration:status
A PHP migration is a class that extends expMigrationPhp with plan(), up() and optionally down().
Transactions
On SQLite and PostgreSQL a migration runs in a full transaction. On MySQL, MariaDB and Oracle only the data changes are transactional. MongoDB has no transactions here.
More commands
exp:migration:dry-run (with --simulate --diff), rollback, resume, convert (YAML migrations of the Symfony-based platform), and the record:start, record:stop and record:list commands. In the administration: Setup, Migrations.
Shipping migrations in an extension
Put the files in extension/<name>/migrations/. They run when the extension is active, under the source name extension:<name>.