Skip to content

Commit

Permalink
Output the SQL command output
Browse files Browse the repository at this point in the history
Display the SQL script output captured during the exec() call.
  • Loading branch information
dchancogne committed Apr 15, 2014
1 parent c0384d3 commit ea6f02e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Console/Command/SqlMigrationShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ private function executeSql($version) {
$database = ConnectionManager::getDataSource('default')->config;
$sql_file = APP.'Config/Sql/upgrade-'.$version.'.sql';
exec("mysql --host=${database['host']} --user=${database['login']} --password=${database['password']} --database=${database['database']} < ${sql_file}", $sqlOutput, $execReturn);
foreach ( $sqlOutput as $line) {
$this->out($line);
}
// In the case of an error code, return an error to the caller
if ($execReturn > 0) {
$this->out('An error occurred trying to execute ' . $sql_file);
Expand Down

0 comments on commit ea6f02e

Please sign in to comment.