Commit 222459f5 authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Fixed issue with RunSqlTask. Added basic support to --update in...

[2.0] Fixed issue with RunSqlTask. Added basic support to --update in SchemaToolTask. Misses some internal implementation
parent bf1a5251
......@@ -41,7 +41,7 @@ class RunSqlTask extends AbstractTask
private function _writeSynopsis($printer)
{
$printer->write('run-sql', 'KEYWORD')
->writeln(' --file=<path> | --sql=<SQL>', 'INFO');
->writeln(' (--file=<path> | --sql=<SQL>)', 'INFO');
}
/**
......@@ -53,7 +53,8 @@ class RunSqlTask extends AbstractTask
return false;
}
$args= $this->getArguments();
$args = $this->getArguments();
$printer = $this->getPrinter();
$isSql = isset($args['sql']);
$isFile = isset($args['file']);
......
......@@ -143,7 +143,7 @@ class SchemaToolTask extends AbstractTask
} else {
$printer->writeln('Creating database schema...', 'INFO');
$tool->createSchema($classes);
$printer->write('Database schema created successfully.' . PHP_EOL, 'INFO');
$printer->writeln('Database schema created successfully.', 'INFO');
}
} else if ($isDrop) {
if (isset($args['dump-sql'])) {
......@@ -156,8 +156,15 @@ class SchemaToolTask extends AbstractTask
$printer->writeln('Database schema dropped successfully.', 'INFO');
}
} else if ($isUpdate) {
//TODO
$printer->writeln('--update not yet implemented.', 'COMMENT');
if (isset($args['dump-sql'])) {
foreach ($tool->getUpdateSchemaSql($classes) as $sql) {
$printer->writeln($sql);
}
} else {
$printer->writeln('Updating database schema...', 'INFO');
$tool->updateSchema($classes);
$printer->writeln('Database schema updated successfully.', 'INFO');
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment