Reset the given migrations.

@param array $migrations
@param array $paths

@return array
545711
protected function resetMigrations(array $migrations, array $paths)
    {
        // Since the getRan method that retrieves the migration name just gives us the
        // migration name, we will format the names into objects with the name as a
        // property on the objects so that we can pass it to the rollback method.
        $migrations = collect($migrations)->map(
            function ($m) {
                return (object) ['migration' => $m];
            }
        )->all();

        return $this->rollbackMigrations($migrations, $paths);
    }
336780
protected function loadMigrationsFrom($paths)
    {
        $this->app->afterResolving('migrator', function ($migrator) use ($paths) {
            foreach ((array) $paths as $path) {
                $migrator->path($path);
            }
        });
    }
1267680
public function getMigrationFiles($paths)
    {
        return Collection::make($paths)->flatMap(function ($path) {
            return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php');
        })->filter()->sortBy(function ($file) {
            return $this->getMigrationName($file);
        })->values()->keyBy(function ($file) {
            return $this->getMigrationName($file);
        })->all();
    }
1224834
private static function normalizePaths($paths) {
    $re = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#'];
    for ($n=1; $n>0; $paths=preg_replace($re, '/', $paths, -1, $n)) {}
    return $paths;
  }
1154379
public function setPaths($paths)
    {
        if ($paths instanceof SplStack) {
            $this->paths = $paths;
        } elseif (is_array($paths)) {
            $this->clearPaths();
            $this->addPaths($paths);
        } else {
            throw new Exception\InvalidArgumentException(
                "Invalid argument provided for \$paths, expecting either an array or SplStack object"
            );
        }

        return $this;
    }
228650
protected function rollbackMigration($migration)
    {
        if ($this->migrator->doesMigrationFileExist($migration)) {
            $this->migrator->rollbackMigration($migration);
        } else {
            $this->markRolledBackWithConfirmation($migration);
        }

        $this->message("<info>Rolled back:</info> {$migration}.php");
    }
374623
public function resetStats(array $entities)
    {
        foreach ($entities as $entity) {
            if ($entity->isAdministrable()) {
                $ids = $this->getService('repos:actors.administrator')->getQuery()->administrable($entity)->disableChain()->fetchValues('administrator.id');
                $entity->set('administratorIds', AnDomainAttribute::getInstance('set')->setData($ids));
            } elseif ($entity->isAdministrator()) {
                $ids = $this->getService('repos:actors.administrator')->getQuery()->administrator($entity)->disableChain()->fetchValues('administrable.id');
                $entity->set('administratingIds', AnDomainAttribute::getInstance('set')->setData($ids));
            }
        }
    }
708849
private function resolveManyMigrations(array $migrationClasses) : array
    {
        $migrations = [];

        foreach ($migrationClasses as $migrationClass) {
            $migrations[] = $this->migrationResolver->resolve($migrationClass);
        }

        return $migrations;
    }
359628
public function getMigrationFiles($paths): array
    {
        return collect($paths)
            ->flatMap(
                function ($path) {
                    return collect(
                        (new Finder)->in([$path])
                            ->files()
                    )
                        ->map(
                            function (SplFileInfo $file) {
                                return $file->getPathname();
                            }
                        )
                        ->all();
                }
            )
            ->filter()
            ->sortBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->values()
            ->keyBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->all();
    }
578829
public function resetStats(array $entities)
    {
        foreach ($entities as $entity) {
            $ids = $this->getService('repos:base.ownership')
                        ->getQuery()
                        ->ownable($entity)
                        ->disableChain()
                        ->fetchValues('owner.id');
            $entity->set('sharedOwnerCount', count($ids));
            $entity->set('sharedOwnerIds', AnDomainAttribute::getInstance('set')->setData($ids));
        }
    }
1154022
private function executeRollBacks(array $migrations) : void
    {
        $this->connection->beginTransaction();

        foreach ($migrations as $migration) {
            $migration->down();
            $this->executedMigrations->delete(get_class($migration));
        }

        $this->connection->commit();
    }
193397
public static function mergeAbsPath(array $paths): array
    {
        if (defined('ABSPATH')) {
            $dir = constant('ABSPATH');
            $path = trailingslashit($dir) . 'preflight.toml';

            $paths[] = normalize_path($path);
        }

        return $paths;
    }
1187172
public function reset($path, Extension $extension = null)
    {
        $migrations = array_reverse($this->repository->getRan(
            $extension ? $extension->getId() : null
        ));

        $count = count($migrations);

        if ($count === 0) {
            $this->note('<info>Nothing to rollback.</info>');
        } else {
            foreach ($migrations as $migration) {
                $this->runDown($path, $migration, $extension);
            }
        }

        return $count;
    }
346806
def run_on_changes(paths)
      if paths.any? { |path| path.match(%r{^db/migrate/(\d+).+\.rb}) } || reset?
        migrations = paths.map { |path| Migration.new(path) }
        migrate(migrations)
      elsif paths.any? { |path| path.match(%r{^db/seeds\.rb$}) }
        seed_only
      end
    end
470204
public function remove($migrationName) {
		$list = $this->getList(false);
		unset($list[$migrationName]);
		$this->writeMigrations($list);
	}
306256
public function setPaths($paths)
    {
        if (!is_array($paths) && !$paths instanceof Traversable) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid argument provided for $paths, expecting either an array or Traversable object, "%s" given',
                is_object($paths) ? get_class($paths) : gettype($paths)
            ));
        }

        $this->clearPaths();
        $this->addPaths($paths);
    }
101525
public function remove($migrationData, array $fields)
    {
        $migrationData['method'] = 'table';

        $compiled = $this->compiler->compile($this->getTemplate(), $migrationData);

        return $this->replaceFieldsWith($this->dropColumns($fields), $compiled);
    }