public function testTheDatabaseMayBeSet()
 {
     $command = new MigrateCommand($migrator = m::mock('Illuminate\\Database\\Migrations\\Migrator'), __DIR__ . '/vendor');
     $app = array('path' => __DIR__);
     $command->setLaravel($app);
     $migrator->shouldReceive('setConnection')->once()->with('foo');
     $migrator->shouldReceive('run')->once()->with(m::type('Symfony\\Component\\Console\\Output\\OutputInterface'), 'application', __DIR__ . '/database/migrations', false);
     $this->runCommand($command, array('--database' => 'foo'));
 }
예제 #2
0
 /**
  * Create a new migration command instance.
  *
  * @param \Gckabir\Arty\Core\Migrator $migrator
  */
 public function __construct(ArtyMigrator $migrator)
 {
     parent::__construct($migrator);
 }
예제 #3
0
 protected function getOptions()
 {
     return array_merge(parent::getOptions(), [['tenant', null, InputOption::VALUE_OPTIONAL, 'The tenant(s) to apply migrations on; use {all|5,8}']]);
 }
예제 #4
0
 /**
  * Get the console command options.
  *
  * @return array
  */
 protected function getOptions()
 {
     return array_merge([['direction', 'd', InputOption::VALUE_OPTIONAL, 'The direction of ordering.', 'asc'], ['fkCheck', null, InputOption::VALUE_OPTIONAL, 'Enable or disable "FOREIGN_KEY_CHECKS".', false]], parent::getOptions());
 }
예제 #5
0
 protected function getOptions()
 {
     $options = parent::getOptions();
     $options[] = ['verbosity', null, InputOption::VALUE_OPTIONAL, 'The verbosity level for migration console output. One of low, medium, or high.'];
     return $options;
 }
예제 #6
0
 protected function registerDefaultContainerItems()
 {
     $this->container['migration-table'] = 'migrations';
     $this->container['migrations-path'] = null;
     $this->container['environment'] = function ($c) {
         global $argv;
         $environment = 'production';
         if (!empty($argv[2]) && preg_match('/--database=(.*?)$/si', $argv[2], $matches)) {
             $environment = $matches[1];
             unset($argv[2]);
         }
         return $environment;
     };
     $this->container['db-config'] = function ($c) {
         require_once $c['config-path'] . $c['environment'] . '.php';
         return ['driver' => 'mysql', 'host' => $db['host'], 'database' => $db['database'], 'username' => $db['username'], 'password' => $db['password'], 'charset' => 'utf8', 'prefix' => '', 'collation' => 'utf8_general_ci', 'schema' => 'public'];
     };
     $this->container['filesystem'] = function ($c) {
         return new \Illuminate\Filesystem\Filesystem();
     };
     $this->container['composer'] = function ($c) {
         $composer = new \Illuminate\Support\Composer($c['filesystem']);
         return $composer;
     };
     $this->container['builder'] = function ($c) {
         $builder = new \Illuminate\Database\Schema\Builder($c['connection']);
         return $builder;
     };
     $this->container['connection'] = function ($c) {
         $manager = new \Illuminate\Database\Capsule\Manager();
         $manager->addConnection($c['db-config']);
         $manager->setAsGlobal();
         $manager->bootEloquent();
         return $manager->getConnection('default');
     };
     $this->container['resolver'] = function ($c) {
         $r = new \Illuminate\Database\ConnectionResolver([$c['environment'] => $c['connection']]);
         $r->setDefaultConnection($c['environment']);
         return $r;
     };
     $this->container['migration-repo'] = function ($c) {
         return new \Illuminate\Database\Migrations\DatabaseMigrationRepository($c['resolver'], $c['migration-table']);
     };
     $this->container['migration-creator'] = function ($c) {
         return new \Illuminate\Database\Migrations\MigrationCreator($c['filesystem']);
     };
     $this->container['migrator'] = function ($c) {
         return new \Illuminate\Database\Migrations\Migrator($c['migration-repo'], $c['resolver'], $c['filesystem']);
     };
     $this->container['install-command'] = function ($c) {
         $command = new Migrations\InstallCommand($c['migration-repo']);
         $command->setLaravel(new FakeLaravel($command, $c['migrations-path']));
         return $command;
     };
     $this->container['migrate-make-command'] = function ($c) {
         $command = new Migrations\MigrateMakeCommand($c['migration-creator'], $c['composer']);
         $command->setLaravel(new FakeLaravel($command, $c['migrations-path']));
         return $command;
     };
     $this->container['migrate-command'] = function ($c) {
         $command = new Migrations\MigrateCommand($c['migrator']);
         $command->setLaravel(new FakeLaravel($command, $c['migrations-path']));
         return $command;
     };
 }
예제 #7
0
 /**
  * @return array
  */
 protected function getOptions()
 {
     return array_merge(parent::getOptions(), $this->getTenantOption());
 }
 /**
  * Get the options.
  *
  * @return array
  */
 protected function getOptions()
 {
     return array_merge(parent::getOptions(), [['addon', null, InputOption::VALUE_OPTIONAL, 'The addon to migrate.'], ['no-addons', null, InputOption::VALUE_NONE, 'Don\'t run addon migrations, only laravel migrations.']]);
 }
예제 #9
0
 /**
  * Get the options.
  *
  * @return array
  */
 protected function getOptions()
 {
     return array_merge(parent::getOptions(), [['addon', null, InputOption::VALUE_OPTIONAL, 'The addon to migrate.'], ['streams', null, InputOption::VALUE_NONE, 'Flag all streams core/application for migration.'], ['all-addons', null, InputOption::VALUE_NONE, 'Flag all addons for migration.']]);
 }