Managing your database(s) with DooPHP

This tutorial will demonstrate how to use the DooManageDb and DooUpdateDb classes to manage your projects database.

These classes have been developed to allow your application(s) to be independent of the database your users choose to use by allowing standard database definition to be used to define your database which is then translated into the SQL needed for the database engine the user is using. It also supports easy upgrading (and downgrading) of the database to allow for better version control support and rolling out of updates and unit testing.

In order to follow this tutorial you will need to use the latest version of DooPHP avaliable form the SVN repository (or version 1.3 or above – not out at the time of writing). The current implementation only supports MySQL and PgSQL at the moment so you will also need one of these 2 databases in order to follow the guide.

The first thing we need to do is to create a simple controller to run our tests from. Therefore create a new controller in your protected/controller/ folder. In this example I will use the controller “DatabaseController”. Now enter the following into the controller:

class DatabaseController extends DooController {

public function updateDatabase() {

echo ‘

Update Database to Head

‘ . PHP_EOL;

/* DB Updater

Previous PostNextNext Post

Leave a Reply

Your email address will not be published.