Database

Contributing database schema changes

Database Migrations

Elgg uses Phinx to manage the database migrations.

Create a migration

To create a new migration run the following in your console:

phinx create -c engine/conf/migrations.php MigrationClassName

This will generate a timestamped skeleton migration in engine/schema/migrations/. Follow Phinx documentation to call the necessary methods to modify the database tables.

Executing a migration

Migrations are executed every time your run upgrade.php. If you would like to execute migrations manually, you can do so via the command line:

phinx migrate -c engine/conf/migrations.php

Check Phinx documentation for additional flags that allow you to run a single migration or a set of migrations within a time range.