Exemplo n.º 1
0
        public IEnumerable <Script> Scan(string upScriptPath, params string[] environment)
        {
            var scriptFiles = _filesystem.GetFiles(upScriptPath, "*.sql")
                              .OrderBy(scriptPath => scriptPath);

            var filteredScriptFiles = scriptFiles.Where(scriptPath =>
                                                        environment.Any(e => scriptPath.FileName().Matches(FilePattern.ForEnvironment(e))) ||
                                                        scriptPath.FileName().Matches(FilePattern.NoEnvironment));

            return(filteredScriptFiles.Select(scriptPath => new Script(scriptPath, ParseVersion(scriptPath.FileName()))));
        }
Exemplo n.º 2
0
        public IEnumerable <Script> Scan(string downScriptPath, params string[] environment)
        {
            var scriptFiles = _filesystem.GetFiles(downScriptPath, "*.sql")
                              .OrderByDescending(s => s);

            var filteredScriptFiles = scriptFiles.Where(s =>
                                                        environment.Any(e => s.FileName().Substring(3).Matches(FilePattern.ForEnvironment(e))) ||
                                                        s.FileName().Substring(3).Matches(FilePattern.NoEnvironment));

            return(filteredScriptFiles.Select(s => new Script(s, ParseRollbackVersion(s.FileName()))));
        }