Public Member Functions | |
| __construct ($app=null) | |
| install () | |
| unInstall () | |
| backup ($path, $name=null) | |
| restore ($path, $name) | |
| migrate ($to_version=null) | |
| installApp ($app, $uninstall=false) | |
| findMigrations () | |
| runMigrations ($migrations) | |
| runMigration ($migration, $the_way='up') | |
| setAppVersion ($app, $version) | |
| delAppInfo ($app) | |
| getAppVersion ($app) | |
Public Attributes | |
| $apps = array() | |
| $to_version = null | |
| $dry_run = false | |
| $display = false | |
Protected Attributes | |
| $app = '' | |
You can directly use the migrate.php script.
Simple example usage:
$m = new Pluf_Migration('MyApp'); $m->migrate();
// Install the application MyApp $m = new Pluf_Migration('MyApp'); $m->install(); // Uninstall the application MyApp $m->unInstall();
$m = new Pluf_Migration(); $m->migrate(); // migrate all the installed app to the newest version.
$m = new Pluf_Migration(); $m->migrate(3); // migrate (upgrade or downgrade) to version 3
| Pluf_Migration::__construct | ( | $ | app = null |
) |
Create a new migration.
| mixed | Application or array of applications to migrate. |
| Pluf_Migration::install | ( | ) |
Install the application.
Basically run the base install function for each application and then set the version to the latest migration.
| Pluf_Migration::unInstall | ( | ) |
Uninstall the application.
| Pluf_Migration::backup | ( | $ | path, | |
| $ | name = null | |||
| ) |
Backup the application.
| string | Path to the backup folder | |
| string | Backup name (null) |
| Pluf_Migration::restore | ( | $ | path, | |
| $ | name | |||
| ) |
Restore the application.
| string | Path to the backup folder | |
| string | Backup name |
| Pluf_Migration::migrate | ( | $ | to_version = null |
) |
Run the migration.
| Pluf_Migration::installApp | ( | $ | app, | |
| $ | uninstall = false | |||
| ) |
Un/Install the given application.
| string | Application to install. | |
| bool | Uninstall (false) |
| Pluf_Migration::findMigrations | ( | ) |
Find the migrations for the current app.
| Pluf_Migration::runMigrations | ( | $ | migrations | ) |
Run the migrations.
From an array of possible migrations, it will first get the current version of the app and then based on $this->to_version will run the migrations in the right order or do nothing if nothing to be done.
| array | Possible migrations. |
| Pluf_Migration::runMigration | ( | $ | migration, | |
| $ | the_way = 'up' | |||
| ) |
Run the given migration.
| Pluf_Migration::setAppVersion | ( | $ | app, | |
| $ | version | |||
| ) |
Set the application version.
| string | Application | |
| int | Version |
| Pluf_Migration::delAppInfo | ( | $ | app | ) |
Remove the application information.
| string | Application |
| Pluf_Migration::getAppVersion | ( | $ | app | ) |
Get the current version of the app.
| string | Application. |
Pluf_Migration::$app = '' [protected] |
Application beeing migrated.
| Pluf_Migration::$apps = array() |
Applications which are going to be migrated.
| Pluf_Migration::$to_version = null |
Target version for the migration.
| Pluf_Migration::$dry_run = false |
Set to true to not act.
| Pluf_Migration::$display = false |
Display on the console what is done.