VersionDB
To Install:
- Add to your composer.json:
"require": {
"philwc/version-db": "dev-master"
}
composer.phar update
parameters:
database:
user: <DBUSER>
password: <DBPASS>
host: <DBHOST>
name: <DBNAME>
changelogtable: changelog
file:
sqlDir: <LOCATION OF SQL FILES>
- Create a new file in the project root called console, with the following contents:
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/philwc/version-db/console';
To Use:
php console add
You will be prompted to fill in the required fields, (*1)
php console upgrade
This will read the SQL Dir (From settings.yml) and apply the update SQL scripts in date order, (*2)
php console downgrade
This will read the changelog table and allow you to select where to downgrade to.
It will then apply the downgrade SQL scripts in date descending order until it hits the record specified., (*3)
There is an example file (index.php) for how to use the front end. The fields may be rendered by the class, using, (*4)
$change = new \philwc\Web\AddChange();
$change->getHtml($action);
or by rendering manually, i.e., (*5)
$change = new \philwc\Web\AddChange();
$html = '
';
echo $html;
, (*6)