Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add --add-drop-table to export command docblock #262

Open
2 tasks done
peterwilsoncc opened this issue Aug 12, 2024 · 3 comments · Fixed by #263
Open
2 tasks done

Docs: Add --add-drop-table to export command docblock #262

peterwilsoncc opened this issue Aug 12, 2024 · 3 comments · Fixed by #263

Comments

@peterwilsoncc
Copy link
Contributor

Bug Report

Describe the current, buggy behavior

The first example in the wp db export docs includes the switch --add-drop-table

# Export database with drop query included
$ wp db export --add-drop-table
Success: Exported to 'wordpress_dbase-db72bb5.sql'.

However the switch is not included in the options section of the docblock.

Describe how other contributors can replicate this bug

See https://developer.wordpress.org/cli/commands/db/export/

Describe what you would expect as the correct outcome

Add the switch to the options section

Let us know what environment you are running this on

OS:	Linux 5.15.0-92-generic #102-Ubuntu SMP Wed Jan 10 09:37:39 UTC 2024 aarch64
Shell:	/bin/bash
PHP binary:	/usr/bin/php7.4
PHP version:	7.4.33
php.ini used:	/etc/php/7.4/cli/php.ini
MySQL binary:	/usr/bin/mysql
MySQL version:	mysql  Ver 8.0.36-0ubuntu0.22.04.1 for Linux on aarch64 ((Ubuntu))
SQL modes:	
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/vagrant/content
WP-CLI packages dir:	
WP-CLI cache dir:	/home/vagrant/.wp-cli/cache
WP-CLI global config:	/home/vagrant/.wp-cli/config.yml
WP-CLI project config:	/vagrant/wp-cli.yml
WP-CLI version:	2.10.0

Provide a possible solution

As above.

Provide additional context/Screenshots

@ernilambar
Copy link
Member

This example looks like mistake to me because even without that flag, SQL dump has DROP TABLE IF EXISTS. May be it should be removed.

@ernilambar
Copy link
Member

@swissspidy See above comment.

@swissspidy
Copy link
Member

Hmm apologies, I missed this conversation here.

add-drop-table is indeed the default in mysqldump via the --opt flag (which is enabled by default). See https://dev.mysql.com/doc/refman/8.4/en/mysqldump.html#option_mysqldump_opt

It's useful when you do e.g. wp db export --skip-opt --add-drop-table though.

I was perhaps a bit overly quick to merge #263. I realized we don't mention all the other mysqldump options in the docs, only the ones relevant for WP-CLI itself. So I think we should remove it again but make the docs and examples clearer what's for mysqldump and what's for WP-CLI.

@swissspidy swissspidy reopened this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants