code: protected function execute(InputInterface $input, OutputInterface $output)
      {
          $this->bootstrap($input, $output);
  
          $container  = $this->getContainer();
          $migrations = $this->getMigrations();
          $versions   = $this->getAdapter()->fetchAll();
  
          $version = $input->getOption('target');
  
          ksort($migrations);
          sort($versions);
  
          if (!empty($versions)) {
              // Get the last run migration number
              $current = end($versions);
          } else {
              $current = 0;
          }
  
          if (null !== $version) {
              if (0 != $version && !isset($migrations[$version])) {
                  return;
              }
          } else {
              $versionNumbers = array_merge($versions, array_keys($migrations));
              if (empty($versionNumbers)) {
                  return;
              }
  
              $version = max($versionNumbers);
          }
  
          $direction = $version > $current ? 'up' : 'down';
          if ($direction == 'down') {
              /**
               * Run downs first
               */
              krsort($migrations);
              foreach($migrations as $migration) {
                  if ($migration->getVersion() <= $version) {
                      break;
                  }
  
                  if (in_array($migration->getVersion(), $versions)) {
                      $container['phpmig.migrator']->down($migration);
                  }
              }
          }
  
          ksort($migrations);
          foreach($migrations as $migration) {
              if ($migration->getVersion() > $version) {
                  break;
              }
  
              if (!in_array($migration->getVersion(), $versions)) {
                  $container['phpmig.migrator']->up($migration);
              }
          }
      }
docs: {@inheritdoc}