Download |
Bug Tracking |
Documentation |
Forum |
Latest Changes |
Home
Let say you want to install the application MyApp. In your
application configuration file, you will have the following:
$cfg['installed_apps'] = array('Pluf', 'MyApp');
Note, that Pluf must be first. So to install the application, you
just need to run the following command:
$ php migrate.php -a -d -i --conf=./MyApp/conf/conf.php
What does it means:
The will install the two applications and ensure that the database schema is matching the one needed by the current code.
To uninstall the applications:
$ php migrate.php -a -d -x --conf=./MyApp/conf/conf.php
You use the migration script but this time with some other parameters.
$ php migrate.php -a -d --conf=./MyApp/conf/conf.php
By default it will perform an upgrade to the latest version. But you can also downgrade to a given version:
$ php migrate.php -a -d -v4 --conf=./MyApp/conf/conf.php --app=MyApp
Note that you cannot migrate all the applications to a given version, you need to do that application by application.
Migrations scripts are located in the folder MyApp/Migrations/.
You need at least one script to install the application
MyApp/Migrations/Install.php and this script provides to functions:
Usually you will create/drop the database tables of your models. Take a look at the Install.php file of Pluf to see what is done.
Upgrade downgrade scripts are in the form
MyApp/Migrations/(\d+)Description.php, par exemple:
MyApp/Migrations/1AddDescriptionField.phpMyApp/Migrations/2CleanOldModel.phpThe number at the start is used to order the migration scripts and to find the latest to be run.
Each script provides 2 functions, one to upgrade to the given version and one to downgrade to the previous version. For example:
function MyApp_Migrations_2CleanOldModel_up($params=null)
function MyApp_Migrations_2CleanOldModel_down($params=null)
Report issues in the documentation
If you find errors or issues in the documentation, report a bug with the label Component-Docs. We will update the documentation accordingly.
Pluf © 2005-2008 Loïc d'Anterroches, supported by Céondo Ltd.