protected function reset(Repository $repository)
    {
        $this->migrator->setconnection($this->input->getOption('database'));

        $migrationPaths = $this->getMigrationPaths($repository);
        $files = $this->migrator->setOutput($this->output)->getMigrationFiles($migrationPaths);

        $migrations = array_reverse($this->migrator->getRepository()->getRan());

        if (count($migrations) == 0) {
            $this->output->writeln("Nothing to rollback.");
        } else {
            $this->migrator->requireFiles($files);

            foreach ($migrations as $migration) {
                if (! array_key_exists($migration, $files)) {
                    continue;
                }

                $this->runDown($files[$migration], (object) ["migration" => $migration]);
            }
        }
    }