protected function execute(InputInterface $input, OutputInterface $output)
 {
     $name = new Name($input->getArgument('name'));
     $isAlreadyApplied = $this->service->isMigrationApplied($name);
     if ($isAlreadyApplied === true) {
         $this->service->migrate($name, Direction::down(), $output);
     } else {
         $this->service->migrate($name, Direction::up(), $output);
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $name = new Name($input->getArgument('name'));
     $force = $input->getOption('force');
     $isAlreadyApplied = $this->service->isMigrationApplied($name);
     if ($isAlreadyApplied === false && !$force) {
         throw new CannotApplyException('Cannot go down - the migration is not applied yet.');
     } else {
         $this->service->migrate($name, Direction::down(), $output);
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $name = new Name($input->getArgument('name'));
     $direction = $input->getArgument('direction') ? new Direction($input->getArgument('direction')) : null;
     $classFile = $this->service->getMigrationClassFileFromName($name);
     if (file_exists($classFile)) {
         require_once $classFile;
     } else {
         throw new MigrationDoesntExist($name, $classFile);
     }
     $this->service->switchToDatabase('mongrate_test_' . $name);
     if ($direction) {
         $this->test($name, $direction);
     } else {
         $this->test($name, Direction::up());
         $this->test($name, Direction::down());
     }
 }
 /**
  * Test to ensure down static method return an instance of Direction with 'down' direction.
  */
 public function testDown()
 {
     $direction = Direction::down();
     $this->assertTrue($direction instanceof Direction);
     $this->assertEquals(DirectionEnum::DOWN, $direction);
 }