NAME
Monorail::Role::Migration
VERSION
version 0.3
DESCRIPTION
This role specifies the requirements for a monorail migration. A monorail migratation needs to define three methods.
- dependencies
-
This method returns an array reference containing the names of all the migrations that need to run before this migration can be run. Usually this is not an extensive list, only a list of migrations needed to walk the entire tree of existing migrations.
- upgrade_steps
-
Returns an array reference of monorail change objects. The migration is the sum of these changes.
- downgrade_steps
-
Returns an array reference of monorail change object. These changes are the logical inverse of the upgrade_steps
This results in a migration script that looks something like:
use Moose;
with 'Monorail::Role::Migration';
sub dependencies { return [qw/other migrations/]}
sub upgrade_steps {
return [
Monorail::Change::AddField->new(...)
]
}
sub downgrade_steps {
return [
Monorail::Change::DropField->new(...)
]
}