当前位置: 首页>>代码示例>>PHP>>正文


PHP Migrator::setconnection方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:cloud5ideas,项目名称:appkit,代码行数:24,代码来源:MigrateResetModuleCommand.php

示例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);
     }
 }
开发者ID:mubassirhayat,项目名称:modules,代码行数:24,代码来源:ModuleMigrateResetCommand.php

示例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.');
     }
 }
开发者ID:arcanedev,项目名称:moduly,代码行数:26,代码来源:MigrateResetCommand.php


注:本文中的Illuminate\Database\Migrations\Migrator::setconnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。