public function run() { $this->consoleOutput('* Running PHP Postgres Migration tools ...' . PHP_EOL); if (!$this->env) { $this->env = $this->config->getEnv(); } if ($this->createFromTemplate) { return $this->createFromTemplate(); } $applied = $this->getAdapter()->getAppliedFiles(); $defined = array_map(function ($file) { return pathinfo($file, PATHINFO_BASENAME); }, glob($this->projectDir . '/migrations/sql/*.sql')); $unprocessed = array_diff($defined, $applied); if (empty($unprocessed)) { $this->consoleOutput('No unprocessed files found for env ' . $this->env . '.' . PHP_EOL); } $this->pgPassChecked = false; foreach ($unprocessed as $sqlFile) { $this->processSqlFile($sqlFile); } return $this; }