Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 1.21 KB

database.rst

File metadata and controls

48 lines (29 loc) · 1.21 KB

Database

Contributing database schema changes

Elgg uses Phinx to manage the database migrations.

Create a migration

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

vendor/bin/phinx create -c engine/schema/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:

// When Elgg is the root project
vendor/bin/phinx migrate -c engine/schema/migrations.php

// When Elgg is installed as a Composer dependency
vendor/bin/phinx migrate -c vendor/elgg/elgg/engine/schema/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.