Migrate Class
The migrate class allows you to run, walk through and revert Migrations from your controllers.
Migrations are supported in the application, in modules and in packages.
Migrates to the current schema set in the migration config.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$name |
'default'
|
Name of the package or module. In case of app, 'default' is used. |
$type |
'app'
|
Type of migration. Valid values are 'app', 'module' and 'package'. |
|
Returns |
bool |
Example |
Migrate::current('default', 'app');
|
Migrates to the latest schema set in the migration config.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$name |
'default'
|
Name of the package or module. In case of app, 'default' is used. |
$type |
'app'
|
Type of migration. Valid values are 'app', 'module' and 'package'. |
|
Returns |
bool |
Example |
Migrate::latest('mypackage', 'package');
|
The version method will move the migrations up or down to set the schema at a specific migration version.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$version |
required |
The version you are migrating to. If you specify null, it will migrate to the latest version. |
$name |
'default'
|
Name of the package or module. In case of app, 'default' is used. |
$type |
'app'
|
Type of migration. Valid values are 'app', 'module' and 'package'. |
|
Returns |
mixed - The number of the version migrated to, or false in case the requested version was the current version. |
Example |
Migrate::version(10, 'mymodule', 'module');
|