private void inspectModule(final Path moduleDir) {

        // Core is always run first so list it first
        final Comparator<String> fileNameComparator = buildFileNameComparator();
        final String moduleName = moduleDir.getFileName().toString();

        Path projectRootDir = moduleDir;
        while (!Files.exists(projectRootDir.resolve(".git"))) {
            projectRootDir = projectRootDir.resolve("..")
                    .toAbsolutePath()
                    .normalize();
        }
        final Path projectRootDirFinal = projectRootDir;

        final List<Path> migrationFiles = new ArrayList<>();

        // For some reason when we used Files.walk() it would fail with a NoSuchFileException
        // on an .attach_pid file, so have to do this.
        try {
            Files.walkFileTree(moduleDir, new FileVisitor<>() {
                @Override
                public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) {
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) {
                    if (Files.isRegularFile(file)
                        && MIGRATION_PATH_REGEX_PATTERN.matcher(file.toString()).matches()
                        && MIGRATION_FILE_REGEX_PATTERN.matcher(file.getFileName().toString()).matches()) {
                        migrationFiles.add(file);
                    } else {
                        LOGGER.debug("No match {}", file);
                    }
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFileFailed(final Path file, final IOException exc) {
                    LOGGER.warn("Error visiting file {}", file, exc);
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) {
                    return FileVisitResult.CONTINUE;
                }
            });
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        migrationFiles.stream()
                .map(path ->
                        new Script(
                                moduleName,
                                path.getFileName().toString(),
                                projectRootDirFinal.relativize(path),
                                path.toAbsolutePath().normalize()))
                .filter(script ->
                        MIGRATION_FILE_REGEX_PATTERN.asMatchPredicate().test(script.fileName()))
                .sorted(Comparator.comparing(Script::fileName, fileNameComparator))
                .forEach(tuple -> {
                    moduleToScriptMap.computeIfAbsent(moduleName, k -> new ArrayList<>())
                            .add(tuple);
                });
    }
Finds all the v7 DB migration scripts and dumps them out in order.
Useful for seeing the sql and java migrations together
stroom-app/src/test/java/stroom/db/migration/TestListDbMigrations.java