Problem/Motivation
The option on db-tools.php for importing a database is "import" but the option for exporting a database is "dump-database-d8-mysql". This is a little silly.
Proposed resolution
Deprecate 'dump*' command.
Rename the option for exporting a database "export".
Remaining tasks
Provide a patch.
User interface changes
The command for exporting a database would be "php db-tools.php export" instead of "php db-tools.php dump-database-d8-mysql".
API changes
n/a
Data model changes
n/a
Release notes snippet
The command for exporting a database would be "php db-tools.php export" instead of "php db-tools.php dump-database-d8-mysql", which matches the shortness of the "import" command.
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | 3213151-23.patch | 35.51 KB | paulocs |
| #23 | interdiff-21-23.txt | 1.52 KB | paulocs |
| #21 | 3213151-21.patch | 35.77 KB | paulocs |
| #21 | interdiff-15-21.txt | 17.72 KB | paulocs |
| #15 | 3213151-15.patch | 20.1 KB | paulocs |
Comments
Comment #2
damienmckennaThis provides a new "export" command and (attempts to) deprecate the old command.
Comment #3
mitthukumawat commentedI have tested the patch and now I can export the database using "Export" . Thanks for the patch.
Comment #4
damienmckennaThank you for the review.
This will hopefully fix the errors in the last patch.
Comment #5
paulocsI'll work on it.
Comment #6
paulocsComment #8
neslee canil pintoComment #10
imalabyaFixed failing tests.
Comment #11
longwaveI don't think we should be renaming this command here, just adding the description?
Comment #12
paulocsAddressing #11.
Comment #13
quietone commentedDbDumpCommand is deprecated. Should be DbExportCommand.
The 'dump' option is undocumented but referred to on https://www.drupal.org/docs/drupal-apis/migrate-api/generating-database-.... Should the test of it be removed?
Also, DbExportCommand looks like a copy of DbdumpCommand, but it is missing this if block.
Comment #14
dhirendra.mishra commentedI have solved the first point by comment in #12.
Comment #15
paulocsPatch #14 changes the wrong file so fixing it.
Should we only update the tests and the documentation and ensure that the export command exists?
I added the if block that was missing in the DbExportCommand (This was added after this issue was created. Good catch @quietone).
Comment #16
marcusvsouza commentedThe patch in comment #15 works fine and correctly changes the command for export database.
Comment #19
quietone commentedI applied that patch and then used 'export' and 'dump' with a drupal 7 database. The output from the commands do not match which I expect them too. I don't think there is any reason that the legacy version needs to be maintained.
There have been changes to DbDumpCommand.php that need to be moved to DbExportCommand, #838992: Change the uid field from integer to serial by leveraging NO_AUTO_VALUE_ON_ZERO on MySQL. There are perhaps ways to change the patch to avoid the disruption here by changes to HEAD but I couldn't find any open issues related to db-tools. It is just unfortunate that there have been recent changes.
I still don't like that tests are being removed. How about we change DbDumpCommand to extend from DbExportCommand and similar for DbDumpApplication. This will simplify the code. Here is an idea for DbDumpCommand.
This is nice, but when I ran the command I expected to be informed of when it will be deprecated. Can this be "Deprecated in Drupal:9.3.0 and is removed from Drupal:10.0.0. Use 'export' instead."
I realize this is from the Dump command but it isn't correct. This will export other databases, not just the current one. How about something like, "Export a database to a generation script."?
Comment #20
paulocsWorking on it.
Comment #21
paulocsThe changes that I made are:
1 - Added #3228237: Always sort tables in db-tools.php dump and #838992: Change the uid field from integer to serial by leveraging NO_AUTO_VALUE_ON_ZERO on MySQL to the
DbExportCommand.phpfile.2 - Changed
DbDumpCommand.phpto extendDbExportCommand.php3 - Changed
DbDumpApplication.phpto extendDbExportApplication.php4 - Updated deprecation message.
5 - Updated
DbExportCommandmessage description.Comment #23
paulocsNew patch.