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


PHP Migrator::getNotes方法代码示例

本文整理汇总了PHP中Illuminate\Database\Migrations\Migrator::getNotes方法的典型用法代码示例。如果您正苦于以下问题:PHP Migrator::getNotes方法的具体用法?PHP Migrator::getNotes怎么用?PHP Migrator::getNotes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Migrations\Migrator的用法示例。


在下文中一共展示了Migrator::getNotes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->prepareDatabase();
     // The pretend option can be used for "simulating" the migration and grabbing
     // the SQL queries that would fire if the migration were to be run against
     // a database for real, which is helpful for double checking migrations.
     $pretend = $this->input->getOption('pretend');
     // Next, we will check to see if a path option has been defined. If it has
     // we will use the path relative to the root of this installation folder
     // so that migrations may be run for any path within the applications.
     if (!is_null($path = $this->input->getOption('path'))) {
         $path = $this->laravel->basePath() . '/' . $path;
     } else {
         $path = $this->getMigrationPath();
     }
     $this->migrator->run($path, $pretend);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
     // Finally, if the "seed" option has been given, we will re-run the database
     // seed task to re-populate the database, which is convenient when adding
     // a migration and a seed at the same time, as it is only this command.
     if ($this->input->getOption('seed')) {
         $this->call('db:seed', ['--force' => true]);
     }
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:37,代码来源:MigrateCommand.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     if (is_null($path = $this->input->getOption('path'))) {
         $path = $this->ask('Please enter the full path of the migration file, without file extension, in the following format: path/migration-file');
     }
     $this->prepareDatabase();
     // The pretend option can be used for "simulating" the migration and grabbing
     // the SQL queries that would fire if the migration were to be run against
     // a database for real, which is helpful for double checking migrations.
     $pretend = $this->input->getOption('pretend');
     // diff from original
     $path = $this->laravel->basePath() . '/' . $path;
     $this->migrator->run($path, ['pretend' => $pretend, 'step' => $this->input->getOption('step')]);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
     // Finally, if the "seed" option has been given, we will re-run the database
     // seed task to re-populate the database, which is convenient when adding
     // a migration and a seed at the same time, as it is only this command.
     if ($this->input->getOption('seed')) {
         $this->call('db:seed', ['--force' => true]);
     }
 }
开发者ID:dushevadnqka,项目名称:migmag,代码行数:34,代码来源:MigrateCommand.php

示例3: fire

 /**
  * Execute the console command.
  *
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->prepareDatabase();
     // The pretend option can be used for "simulating" the migration and
     // grabbing the SQL queries that would fire if the migration were to be
     // run against a database for real, which is helpful for double checking
     // migrations.
     $pretend = $this->input->getOption('pretend');
     $path = $this->getMigrationPath();
     $this->migrator->run($path, $pretend);
     // Once the migrator has run we will grab the note output and send it
     // out to the console screen, since the migrator itself functions
     // without having any instances of the OutputInterface contract passed
     // into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
     // Finally, if the "seed" option has been given, we will re-run the
     // database seed task to re-populate the database, which is convenient
     // when adding a migration and a seed at the same time, as it is only
     // this command.
     if ($this->input->getOption('seed')) {
         $this->call('db:seed', ['--force' => true]);
     }
 }
开发者ID:MarkVaughn,项目名称:illuminated,代码行数:32,代码来源:MigrateCommand.php

示例4: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->migrator->setConnection($this->option('database'));
     $paths = $this->getMigrationPaths();
     $this->migrator->rollback($paths, ['pretend' => $this->option('pretend'), 'step' => (int) $this->option('step')]);
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }
开发者ID:caffeinated,项目名称:modules,代码行数:17,代码来源:ModuleMigrateRollbackCommand.php

示例5: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->migrator->setConnection($this->input->getOption('database'));
     $pretend = $this->input->getOption('pretend');
     $this->migrator->rollback($pretend);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:17,代码来源:RollbackCommand.php

示例6: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->migrator->setConnection($this->option('database'));
     $this->migrator->rollback($this->getMigrationPaths(), ['pretend' => $this->option('pretend'), 'step' => (int) $this->option('step')]);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }
开发者ID:mark86092,项目名称:laravel-framework,代码行数:19,代码来源:RollbackCommand.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->prepareDatabase();
     // The pretend option can be used for "simulating" the migration and grabbing
     // the SQL queries that would fire if the migration were to be run against
     // a database for real, which is helpful for double checking migrations.
     $pretend = $this->input->getOption('pretend');
     $path = $this->getMigrationPath();
     $this->migrator->run($path, $pretend);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:21,代码来源:MigrateCommand.php

示例8: migrate

 /**
  * Run migrations for the specified module.
  *
  * @param string $slug
  *
  * @return mixed
  */
 protected function migrate($slug = null)
 {
     $pretend = Arr::get($this->option(), 'pretend', false);
     if (!is_null($slug) && $this->module->exists($slug)) {
         $path = $this->getMigrationPath($slug);
         if (floatval(App::version()) > 5.1) {
             $pretend = ['pretend' => $pretend];
         }
         $this->migrator->run($path, $pretend);
         // Once the migrator has run we will grab the note output and send it out to
         // the console screen, since the migrator itself functions without having
         // any instances of the OutputInterface contract passed into the class.
         foreach ($this->migrator->getNotes() as $note) {
             if (!$this->option('quiet')) {
                 $this->line($note);
             }
         }
         // Finally, if the "seed" option has been given, we will re-run the database
         // seed task to re-populate the database, which is convenient when adding
         // a migration and a seed at the same time, as it is only this command.
         if ($this->option('seed')) {
             $this->call('module:seed', ['module' => $slug, '--force' => true]);
         }
     } else {
         $modules = $this->module->all();
         if (count($modules) == 0) {
             return $this->error("Your application doesn't have any modules.");
         }
         $migrationsAll = [];
         foreach ($modules as $module) {
             $path = $this->getMigrationPath($module['slug']);
             $files = $this->migrator->getMigrationFiles($path);
             $ran = $this->migrator->getRepository()->getRan();
             $migrations = array_diff($files, $ran);
             $this->migrator->requireFiles($path, $migrations);
             $migrationsAll = array_merge($migrationsAll, $migrations);
         }
         if (floatval(App::version()) > 5.1) {
             $pretend = ['pretend' => $pretend];
         }
         sort($migrationsAll);
         $this->migrator->runMigrationList($migrationsAll, $pretend);
         // Once the migrator has run we will grab the note output and send it out to
         // the console screen, since the migrator itself functions without having
         // any instances of the OutputInterface contract passed into the class.
         foreach ($this->migrator->getNotes() as $note) {
             if (!$this->option('quiet')) {
                 $this->line($note);
             }
         }
         // Finally, if the "seed" option has been given, we will re-run the database
         // seed task to re-populate the database, which is convenient when adding
         // a migration and a seed at the same time, as it is only this command.
         if ($this->option('seed')) {
             foreach ($modules as $module) {
                 $this->call('module:seed', ['module' => $module['slug'], '--force' => true]);
             }
         }
     }
 }
开发者ID:samoilenkoevgeniy,项目名称:modules,代码行数:67,代码来源:ModuleMigrateCommand.php

示例9: migrate

 /**
  * Run migrations for the specified module.
  *
  * @param  string $slug
  * @return mixed
  */
 protected function migrate($slug)
 {
     $moduleName = Str::studly($slug);
     if ($this->module->exists($slug)) {
         $pretend = $this->option('pretend');
         $path = $this->getMigrationPath($slug);
         $this->migrator->run($path, $pretend);
         // Once the migrator has run we will grab the note output and send it out to
         // the console screen, since the migrator itself functions without having
         // any instances of the OutputInterface contract passed into the class.
         foreach ($this->migrator->getNotes() as $note) {
             if (!$this->option('quiet')) {
                 $this->output->writeln($note);
             }
         }
         // Finally, if the "seed" option has been given, we will re-run the database
         // seed task to re-populate the database, which is convenient when adding
         // a migration and a seed at the same time, as it is only this command.
         if ($this->option('seed')) {
             $this->call('module:seed', ['module' => $slug, '--force' => true]);
         }
     } else {
         return $this->error("Module [{$moduleName}] does not exist.");
     }
 }
开发者ID:hamrahpay,项目名称:modules,代码行数:31,代码来源:ModuleMigrateCommand.php

示例10: migrate

 /**
  * Run migrations for the specified module.
  *
  * @param string $slug
  *
  * @return mixed
  */
 protected function migrate($slug)
 {
     if ($this->module->exists($slug)) {
         $module = $this->module->where('slug', $slug);
         $pretend = Arr::get($this->option(), 'pretend', false);
         $path = $this->getMigrationPath($slug);
         if (floatval(App::version()) > 5.1) {
             $pretend = ['pretend' => $pretend];
         }
         $this->migrator->run($path, $pretend);
         event($slug . '.module.migrated', [$module, $this->option()]);
         // Once the migrator has run we will grab the note output and send it out to
         // the console screen, since the migrator itself functions without having
         // any instances of the OutputInterface contract passed into the class.
         foreach ($this->migrator->getNotes() as $note) {
             if (!$this->option('quiet')) {
                 $this->line($note);
             }
         }
         // Finally, if the "seed" option has been given, we will re-run the database
         // seed task to re-populate the database, which is convenient when adding
         // a migration and a seed at the same time, as it is only this command.
         if ($this->option('seed')) {
             $this->call('module:seed', ['module' => $slug, '--force' => true]);
         }
     } else {
         return $this->error('Module does not exist.');
     }
 }
开发者ID:nickurt,项目名称:modules,代码行数:36,代码来源:ModuleMigrateCommand.php

示例11: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->migrator->setConnection($this->input->getOption('database'));
     if (!$this->migrator->repositoryExists()) {
         $this->output->writeln('<comment>Migration table not found.</comment>');
         return;
     }
     $pretend = $this->input->getOption('pretend');
     $this->migrator->reset($pretend);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }
开发者ID:artesaos,项目名称:migrator,代码行数:24,代码来源:ResetCommand.php

示例12: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->migrator->setConnection($this->option('database'));
     // First, we'll make sure that the migration table actually exists before we
     // start trying to rollback and re-run all of the migrations. If it's not
     // present we will just bail out with a info message for the developer.
     if (!$this->migrator->repositoryExists()) {
         return $this->comment('Migration table not found.');
     }
     $this->migrator->reset($this->getMigrationPaths(), $this->option('pretend'));
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:25,代码来源:ResetCommand.php

示例13: rollbackModules

 /**
  * @return $this
  */
 public function rollbackModules()
 {
     while (true) {
         $count = $this->migrator->rollback();
         foreach ($this->migrator->getNotes() as $note) {
             $this->output($note);
         }
         if ($count == 0) {
             break;
         }
     }
     return $this;
 }
开发者ID:aselushat,项目名称:module-loader,代码行数:16,代码来源:ModulesInstaller.php

示例14: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->prepareDatabase();
     // Next, we will check to see if a path option has been defined. If it has
     // we will use the path relative to the root of this installation folder
     // so that migrations may be run for any path within the applications.
     $this->migrator->run($this->getMigrationPaths(), ['pretend' => $this->option('pretend'), 'step' => $this->option('step')]);
     // Once the migrator has run we will grab the note output and send it out to
     // the console screen, since the migrator itself functions without having
     // any instances of the OutputInterface contract passed into the class.
     foreach ($this->migrator->getNotes() as $note) {
         $this->output->writeln($note);
     }
     // Finally, if the "seed" option has been given, we will re-run the database
     // seed task to re-populate the database, which is convenient when adding
     // a migration and a seed at the same time, as it is only this command.
     if ($this->option('seed')) {
         $this->call('db:seed', ['--force' => true]);
     }
 }
开发者ID:mage2,项目名称:project-management-system,代码行数:28,代码来源:MigrateCommand.php

示例15: resetModules

 /**
  * @return $this
  */
 public function resetModules()
 {
     $this->output('Starting process of reseting...');
     foreach ($this->_modules as $module) {
         $this->resetModule($module);
     }
     /*
      * Rollback modules
      */
     while (true) {
         $count = $this->_migrator->rollback();
         foreach ($this->_migrator->getNotes() as $note) {
             $this->output($note);
         }
         if ($count == 0) {
             break;
         }
     }
     return $this;
 }
开发者ID:BlueCatTAT,项目名称:kodicms-laravel,代码行数:23,代码来源:ModuleInstaller.php


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