本文整理汇总了PHP中Migration::up方法的典型用法代码示例。如果您正苦于以下问题:PHP Migration::up方法的具体用法?PHP Migration::up怎么用?PHP Migration::up使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Migration
的用法示例。
在下文中一共展示了Migration::up方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
public function action($argv)
{
$command = $argv[1];
if ($command == 'migrate' || $command == '-m') {
$migration = new Migration();
$migration->up();
} elseif ($command == 'rollback' || $command == '-r') {
$migration = new Migration();
$migration->rollback();
} elseif ($command == 'status' || $command == '-s') {
$migration = new Migration();
$migration->printStatus();
} elseif ($command === 'help' || $command == '-h') {
Debug::out('Command: -h (help)');
Debug::out('migrate or -m');
Debug::out('rollback or -r');
Debug::out('status or -s');
} else {
Debug::out('Command unknown. Try -h for help.');
}
}
示例2: runMigration
/**
* Runs a single migration.
*
* @param Migration $migration
*
* @return int
*/
protected function runMigration(Migration $migration)
{
$result = $migration->up();
$class = get_class($migration);
$this->runStack[$class] = $migration;
return $result;
}
示例3: load_file
function load_file($filepath)
{
$rootPath = getcwd() . "/..";
if (file_exists($rootPath . $filepath)) {
require_once $rootPath . $filepath;
return 1;
} else {
return 0;
}
}
//Migrate
load_file('/config/config_local.php');
load_file('/library/debug.php');
load_file('/library/naming_convention.php');
load_file('/app/exception/database_exception.php');
load_file('/library/db/db.php');
load_file('/library/active_record.php');
load_file('/library/migration.php');
$migration = new Migration();
$migration->up();
//Seeds
load_file('/library/object.php');
load_file('/library/db/db_obj.php');
load_file('/library/db/db_model.php');
load_file('/library/db/repository.php');
load_file('/db/seed.php');
echo '== creating seed' . "\n";
$seed = new Seed();
$seed->create();
echo '== setup done' . "\n";