Migrations/Dependencies

Dependencies tell the Migrator what order Migrations must be installed in.

Declaring Dependencies
In your Migration file, add a static public function named depends_on, returning an array. static public function depends_on {	return array; }

All you must do is add the class name of the Migration that the current Migration depends on.

For example, phpbb\db\migration\data\v310\dev that 3.0.11, extensions, style update, reported posts display, and timezone are installed. static public function depends_on {		return array(			'\phpbb\db\migration\data\v310\extensions',			'\phpbb\db\migration\data\v310\style_update_p2',			'\phpbb\db\migration\data\v310\timezone_p2',			'\phpbb\db\migration\data\v310\reported_posts_display',			'\phpbb\db\migration\data\v310\migrations_table',		); }}

depends_on creates a tree
Imagine the following situation:

This dependency setup would cause the following Migrations to be installed when an individual Migration was installed.

Assumes phpbb\db\migration\data\v310\dev is already installed.

What does this mean for me?
You must specify all dependencies that the current Migration has, but not any that the dependencies list as dependencies for their own installation.

This means that migration_5 doesn't need to list migration_1 through migration_4 as a dependency, only migration_3 and migration_4 because those Migrations require migration_1 and migration_2.

This also means that the desired order of operations is preserved. In the above example, migration_4 modifies the feature in migration_2 and must be applied after migration_2 is installed. Similarly, in the above example, migration_5 is the release of 1.0.1, which requires both of the two new features to be installed before it is 1.0.1.