protected function _before()
 {
     buildSchema();
 }
Example #2
0
if (PHP_SAPI !== 'cli') {
    die;
}
// action
$action = @$argv[1];
// parameter
$parameter = @$argv[2];
// base path to application
if (!defined('BASEPATH')) {
    define('BASEPATH', dirname(__FILE__) . '/..');
}
include_once 'helpers.php';
// 'menu'
switch ($action) {
    case "build":
        buildSchema();
        break;
    case '-help':
    case 'help':
    case '':
        message("Usage: php script/db.php [build]", 'green');
        break;
    default:
        // fail
        message("Couldn't find '{$action}' generator try 'help'", 'red');
}
/********************* build sql schema *********************/
/**
 * Build schema from settings file.
 */
function buildSchema()