wp-cli / db-command

Performs basic database operations using credentials stored in wp-config.php.
MIT License
71 stars 59 forks source link

Db clean not removing all tables with $table_prefix #150

Closed canonex closed 5 years ago

canonex commented 5 years ago

wp db clean is not removing all tables with $table_prefix: custom tables are not removed.

If we have $table_prefix = "wp_"; and install some plugins (ex. Pods with or without Table Storage plugin) that creates tables like wp_pods_company or wp_podsrel or we manually create tables with the correct prefix like wp_goodtable the command fails to delete these new tables. So not "all" tables with $table_prefix are removed.

To reproduce: create a new table in the wordpress db with the prefix set in wp-config.php. run wp db clean manual or plugin (tested with Pods in different scenarios) created tables are still there

Why it is important: as already posted, not as bug report, in https://github.com/wp-cli/db-command/pull/93#issuecomment-537586287 wp clean is a unique feature, well different from db reset.

Expected: I expect all tables with $table_prefix to be removed, as stated in the documentation.

If, for some reason, this is not possible, I expect the documentation to be updated specifying in which case and by which criteria the tables are removed.

Thank you, Riccardo

My OS OS: Linux 4.19.0-6-amd64 # 1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 Shell: /bin/bash PHP binary: /usr/bin/php7.3 PHP version: 7.3.9-1~deb10u1 php.ini used: /etc/php/7.3/cli/php.ini WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli WP-CLI vendor dir: phar://wp-cli.phar/vendor WP-CLI version: 2.1.0