• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Migrations\Migrator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $capsule = app('capsule');
     $connectionResolver = $capsule->getDatabaseManager();
     $repository = new DatabaseMigrationRepository($connectionResolver, 'migrations');
     if (!$repository->repositoryExists()) {
         $repository->createRepository();
     }
     $migrator = new Migrator($repository, $connectionResolver, new Filesystem());
     return $migrator->run(__DIR__ . '/../database/migrations');
 }
开发者ID:lihuibin,项目名称:notejam_blink,代码行数:11,代码来源:MigrateCommand.php


示例2: resolve

 public function resolve($file)
 {
     /* @var $class \Consolet\Migrator\Migration */
     $class = parent::resolve($file);
     $class::setSchemaOnce($this->resolveConnection(null)->getSchemaBuilder());
     return $class;
 }
开发者ID:yusukezzz,项目名称:migrator,代码行数:7,代码来源:Migrator.php


示例3: __construct

 /**
  * Returns a new TenantMigrator instance.
  * 
  * @param MigrationRepositoryInterface $repository
  * @param Resolver                     $resolver
  * @param Filesystem                   $files
  * @param TenantManager                $manager
  */
 public function __construct(MigrationRepositoryInterface $repository, Resolver $resolver, Filesystem $files, TenantManager $manager)
 {
     $this->manager = $manager;
     // There is nothing special about the TenantMigrationResolver class, so let's just new up one.
     $this->tenantMigrationResolver = new TenantMigrationResolver();
     parent::__construct($repository, $resolver, $files);
 }
开发者ID:stillat,项目名称:database,代码行数:15,代码来源:TenantMigrator.php


示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $config = (require __DIR__ . '/../config.php');
     $capsule = new Manager();
     $capsule->addConnection($config);
     $capsule->bootEloquent();
     Schema::setConnection($capsule->getConnection('default'));
     DB::setConnection($capsule->getConnection('default'));
     // run the migrations
     $migration_repo = new DatabaseMigrationRepository(Model::getConnectionResolver(), 'migrations');
     if (!$migration_repo->repositoryExists()) {
         $migration_repo->createRepository();
     }
     $migrator = new Migrator($migration_repo, Model::getConnectionResolver(), new Filesystem());
     $migrator->rollback();
     $migrator->run(__DIR__ . '/../../src/migrations');
     static::loadFixtures();
 }
开发者ID:dadleyy,项目名称:lvpress,代码行数:19,代码来源:TestCase.php


示例5: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $migrationsPath = APP_ROOT . 'db/migrations/';
     $c = $this->app->container();
     $migrationsTableName = 'migrations';
     $dbResolver = $c['database.manager']->getDatabaseManager();
     $filesystem = new Filesystem();
     // Get the database migrations repository (create if not existant)
     $repository = new MigrationRepo($dbResolver, $migrationsTableName);
     if (!$repository->repositoryExists()) {
         $repository->createRepository();
     }
     // Run!
     $migrator = new Migrator($repository, $dbResolver, $filesystem);
     $migrator->run($migrationsPath);
     // Show notes
     foreach ($migrator->getNotes() as $note) {
         $output->writeln(preg_replace('(<[a-zA-Z/]+>)', '', $note));
     }
     $output->writeln('');
     $output->writeln('Migrated!');
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:22,代码来源:MigrateCommand.php


示例6: mergeMigratorNotes

 /**
  * Merge migrator operation notes.
  *
  * @param  \Illuminate\Database\Migrations\Migrator  $migrator
  *
  * @return void
  */
 protected function mergeMigratorNotes(BaseMigrator $migrator)
 {
     $this->notes = array_merge($this->notes, $migrator->getNotes());
 }
开发者ID:DavidIWilson,项目名称:site1,代码行数:11,代码来源:NotableTrait.php


示例7: __construct

 /**
  * Construct an instance of a NamespacedMigrator.
  *
  * @param MigrationRepositoryInterface $repository
  * @param Resolver $resolver
  * @param Filesystem $files
  * @param string $namespace
  */
 public function __construct(MigrationRepositoryInterface $repository, Resolver $resolver, Filesystem $files, $namespace = '')
 {
     parent::__construct($repository, $resolver, $files);
     $this->namespace = $namespace;
 }
开发者ID:MarkVaughn,项目名称:illuminated,代码行数:13,代码来源:NamespacedMigrator.php


示例8: __construct

 /**
  * Migrator constructor.
  *
  * @param \Illuminate\Container\Container                              $container
  * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository
  * @param \Illuminate\Database\ConnectionResolverInterface             $resolver
  * @param \Illuminate\Filesystem\Filesystem                            $files
  */
 public function __construct(Container $container, MigrationRepositoryInterface $repository, Resolver $resolver, Filesystem $files)
 {
     $this->container = $container;
     parent::__construct($repository, $resolver, $files);
 }
开发者ID:notadd,项目名称:framework,代码行数:13,代码来源:Migrator.php


示例9: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->migrator->setConnection($this->input->getOption('database'));
     $pretend = $this->input->getOption('pretend');
     while ($this->migrator->rollback($this->output, $pretend)) {
     }
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:12,代码来源:ResetCommand.php


示例10: prepareDatabase

 /**
  * Prepare the migration database for running.
  *
  * @return void
  */
 protected function prepareDatabase()
 {
     $this->migrator->setConnection($this->input->getOption('database'));
     if (!$this->migrator->repositoryExists()) {
         $options = ['--database' => $this->input->getOption('database')];
         $this->call('migrate:install', $options);
     }
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:13,代码来源:MigrateCommand.php


示例11: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->migrator->setConnection($this->input->getOption('database'));
     $package = $this->input->getOption('package') ?: 'application';
     // 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($this->output, $package, $path, $pretend);
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:16,代码来源:MigrateCommand.php


示例12: 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


示例13: 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


示例14: 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


示例15: runDown

 /**
  * Run "down" a migration instance. (Overridden)
  *
  * @param  object $migration
  * @param  bool   $pretend
  * @return void
  */
 protected function runDown($migration, $pretend)
 {
     $migrations = [$migration->migration];
     // Retrieve migration path and throw exception if it doesn't exist
     $path = $this->getMigrationPath(true);
     $this->requireFiles($path, $migrations);
     parent::runDown($migration, $pretend);
 }
开发者ID:singularity321,项目名称:Arty,代码行数:15,代码来源:Migrator.php


示例16: prepareDatabase

 /**
  * Prepare the migration database for running.
  */
 private function prepareDatabase()
 {
     if ($database = $this->getStringOption('database')) {
         $this->migrator->setConnection($database);
     }
     if (!$this->migrator->repositoryExists()) {
         $this->call('migrate:install', ['--database' => $database]);
     }
 }
开发者ID:arcanedev,项目名称:moduly,代码行数:12,代码来源:MigrateCommand.php


示例17: 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


示例18: run

 public function run($path, $pretend = false)
 {
     parent::run($path, $pretend);
     $key = Config::get('database.default');
     $database = Config::get('database.connections.' . $key . '.database');
     $this->note('<info>Generating schema for: ' . $database . '</info>');
     $builder = new Builder();
     $builder->convert($database);
     $builder->write();
 }
开发者ID:kreitje,项目名称:l4-schemad-migrations,代码行数:10,代码来源:Migrator.php


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Query\Builder类代码示例发布时间:2022-05-23
下一篇:
PHP Relations\Relation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap