mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[request] option to only use SQL in dumped schema information #5945
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @holtkamp on GitHub (Apr 10, 2018).
Currently the dumped information of the UpdateCommand also includes non-SQL text:
"The following SQL statements will be executed:"
Is there a specific reason to do this? We currently store the output in a .sql file, which can then be easily executed, for example when spinning up a Docker instance. But the generated SQL is now "invalid" due to the help text.
Of course this text can be stripped after generation, but still, it feels awkward.
@Ocramius commented on GitHub (Apr 10, 2018):
Good question, but a few problems arise:
dumpcommand is, as it says, todumpinformation, not to generate an actually usable SQL string. For that, using the diffing tools directly would be more appropriate.@holtkamp commented on GitHub (Apr 10, 2018):
True, also saw some commented "stripping" functionality in my scripts from the time when the warnings were printed in the beginning of the output, just re-activated /re-used that 😉
Also true. Maye a dedicated Command is required to write the output to a SQL file...
I kind of triggered when I saw this warning is not printed when being dumped / forced.
For now closing issue and stripping the first three lines from the outputted information.
@Nek- commented on GitHub (Apr 10, 2018):
I think this feature may be discussed as it's interesting. Of course it's easy to use the
SchemaToolsto get the queries we want. But it could also be provided by default using some arguments or option to the command.Maybe adding a "non-verbose" option is a good idea?
Suggestion for names:
--simple--sql-only--dump-onlyOr in Doctrine3 it could be just change with adding a value to the dump arg. What do you think about?
It is a simple contribution that could be done at events like hacktoberfest fest.
@holtkamp commented on GitHub (Apr 10, 2018):
Aah, I now see I referenced the UpdateCommand. That should be the CreateCommand 😊
I guess
--sql-onlywould be my choice, since it seems semantically most correct:@Nek- commented on GitHub (Apr 10, 2018):
Both may be modifiy in this way. What do you think @Ocramius ?
@Ocramius commented on GitHub (Apr 13, 2018):
Adding a flag that excludes all output and disables colors implicitly seems fine 👍