Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Migrations

The start of everything about migrations in Exponential 6.0.15 - schema and content changes written once as files under version control and applied to every installation of a site in the same order, with a caption…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/migrations/README.md

On this page

Migrations

A migration is a change to an installation (a table, a column, a content class, content, a role, a setting) written once in a PHP file under version control and applied to every installation of the site (development, staging, production) in the same order. Exponential 6.0.15 runs migrations in the kernel: it records what ran where, takes a caption (a safe point) before every run, restores it automatically when a migration fails, and commits, tags and pushes the record of every run.

Looking for something else? Moving a site to another server, upgrading it to a new release or bringing content in from another system is migrating a site, a different job with its own pages: Migrations versus migrating a site.

Contents

  1. Start here
  2. Who it is for
  3. Recipes
  4. In the administration
  5. Reference
  6. When something goes wrong
  7. YAML migrations
  8. What 6.0.15 has, and what comes later
  9. Related pages

Start here

You want to ...Start withThen
write your first migration (about 20 minutes)the tutorialPHP migrations, the recipes
understand what migrations are and how a run worksthe guideRollback and captions, the migrations repository
apply migrations other people wroteMigrations for administratorsIn the administration, Run, dry run and rollback
find your way around Setup > MigrationsA tour of Setup > MigrationsThe status and the history
turn changes made by hand into a migrationRecording changesGenerating migrations, The migration editor
put the migrations on staging and productionAdd a remote step by stepDeploy step by step
ship changes as a team, through CI to productionTeam workflow with gitTesting migrations, Deploying with migrations
move from Doctrine Migrations, the Kaliop bundle or SQL update filesComing from Doctrine MigrationsKaliop, SQL update files

The five commands of every day:

./console exp:migration:generate --skeleton add_news_table --apply   # a new PHP migration in migrations/
./console exp:migration:check                                         # the lint: names, headers, order, PHP (no database)
./console exp:migration:migrate                                       # dry run: what would change
./console exp:migration:migrate --apply                               # caption, run, re-caption, commit, tag, push
./console exp:migration:status                                        # what is done and what is pending

Run them from the installation root as the user the web server runs as (as root, add --allow-root-user). Every command that writes is a dry run until it is given --apply.

Who it is for

You are ...Your page
a software engineer who designs how changes reach productionMigrations for software engineers
a PHP developer who writes the migration classesWriting migrations in PHP
an administrator who runs them on staging and productionMigrations for administrators
a hosting company or a database administratorMigrations on hosted sites
an agency or integrator with many client sitesMigrations in client projects
a trainerLesson 9.5: Migrations, with an exercise
a DXP developer who knows Doctrine MigrationsExponential migrations for Doctrine users

Recipes

Each recipe is one task: what you will have at the end, the steps with their output, the complete migration, how to check it, how to take it back, and the next step. All recipes.

The database schema

Content classes and content

Settings, roles and policies

Where migrations live and run

Quality

Teams and delivery

Safety and the record

Coming from another tool

In the administration

Setup > Migrations shows every migration with its state, runs the pending ones in the background, simulates a run and takes a run or a migration back, records changes, writes migrations in its editor, and deploys them to other installations. The dashboard has a Migrations block, and the website sidebar a panel. Every page below has step-by-step instructions with screenshots.

Reference

PageWhat it lists
The guidethe whole model: life cycle, files, order, header, environments, record, transactions, lock, every switch
PHP migrationsthe class, its methods, the context, transactions, failure, events, testing
The migration file formatfile names, the header, the order, the checksum, the record tables, the status file, the run log, the machine output
Commandsevery exp:migration:* command, with a link to its generated page
Settingsevery block of migration.ini, with a link to its generated page
Policies, views and eventsthe policies, the views of the module migration, the events and the audit events
The featurewhat 6.0.15 adds, the classes, the engines, the limits
Upgrading with the consoleexp:upgrade, whose steps are listed and run among the migrations

When something goes wrong

YAML migrations

A migration can be a list of YAML steps instead of a PHP class: content, locations and versions, classes and class groups, users, user groups and roles, sections, languages and object states. The engine, its placeholders, conditions and loops: the file format; the step types: YAML migration steps and every step type. The recipes here are written in PHP; each of them can be written as YAML steps too where a step type covers it.

What 6.0.15 has, and what comes later

In 6.0.15Not yet
PHP, YAML, SQL and INI migrations in the site, in active extensions and in installed packages
the dry run, and the simulation with a diff on PostgreSQL and SQLitea simulation on MySQL/MariaDB, Oracle and MongoDB (the plan is listed)
captions, the automatic restore, rollback of a run, of a migration and of any caption
generators from a recording, from content, classes, roles, sections and settings, from a difference, and skeletons; the editor in the administration
commit, tag and push of every run's record; the cronjob part migrationpushexp:velocity deploy --migrate
Setup > Migrations, background runs, recording, the editor, remotes and deploys, the dashboard block and the sidebar panel
the kernel's upgrade steps listed and run among the migrations (stages database and scripts)the stages code, libraries and finish stay with exp:upgrade

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x