本文整理汇总了PHP中Illuminate\Database\Migrations\Migrator::setconnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Migrator::setconnection方法的具体用法?PHP Migrator::setconnection怎么用?PHP Migrator::setconnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Migrations\Migrator
的用法示例。
在下文中一共展示了Migrator::setconnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reset
/**
* Run the migration reset for the specified module.
*
* @param string $slug
* @return mixed
*/
protected function reset($slug)
{
$this->migrator->setconnection($this->input->getOption('database'));
$pretend = $this->input->getOption('pretend');
$migrationPath = $this->getMigrationPath($slug);
$migrations = $this->migrator->getMigrationFiles($migrationPath);
if (count($migrations) == 0) {
return $this->error('Nothing to rollback.');
}
// We need to reverse these migrations so that they are "downed" in reverse
// to what they run on "up". It lets us backtrack through the migrations
// and properly reverse the entire database schema operation that originally
// ran.
foreach ($migrations as $migration) {
$this->info('Migration: ' . $migration);
$this->runDown($slug, $migration, $pretend);
}
}
示例2: reset
/**
* Run the migration reset for the specified module.
*
* Migrations should be reset in the reverse order that they were
* migrated up as. This ensures the database is properly reversed
* without conflict.
*
* @param string $slug
* @return mixed
*/
protected function reset($slug)
{
$this->migrator->setconnection($this->input->getOption('database'));
$pretend = $this->input->getOption('pretend');
$migrationPath = $this->getMigrationPath($slug);
$migrations = array_reverse($this->migrator->getMigrationFiles($migrationPath));
if (count($migrations) == 0) {
return $this->error('Nothing to rollback.');
}
foreach ($migrations as $migration) {
$this->info('Migration: ' . $migration);
$this->runDown($slug, $migration, $pretend);
}
}
示例3: reset
/**
* Run the migration reset for the specified module.
*
* Migrations should be reset in the reverse order that they were
* migrated up as. This ensures the database is properly reversed
* without conflict.
*
* @param string $slug
*/
protected function reset($slug)
{
if ($this->getStringOption('database')) {
$this->migrator->setconnection($this->getStringOption('database'));
}
$pretend = $this->getBooleanOption('pretend');
$migrationPath = $this->getMigrationPath($slug);
$migrations = array_reverse($this->migrator->getMigrationFiles($migrationPath));
if (count($migrations)) {
foreach ($migrations as $migration) {
$this->info('Migration: ' . $migration);
$this->runDown($slug, $migration, $pretend);
}
} else {
$this->error('Nothing to rollback.');
}
}