You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 15acb52
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -472,6 +472,10 @@ Requires `mysqldump` or `mariadb-dump` client binary to be available.
472
472
[--exclude_tables=<tables>]
473
473
The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
474
474
475
+
[--exclude_tables_data=<tables>]
476
+
The comma separated list of specific tables for which only the structure will be exported. Excluding this parameter will export data for all tables in the export.
477
+
Requires a dump client that supports --ignore-table-data (mariadb-dump from MariaDB 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.3 or later); MySQL's mysqldump does not. Cannot be combined with --tables.
478
+
475
479
[--include-tablespaces]
476
480
Skips adding the default --no-tablespaces option to mysqldump.
477
481
@@ -519,6 +523,10 @@ Requires `mysqldump` or `mariadb-dump` client binary to be available.
519
523
$ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
520
524
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
521
525
526
+
# Skip data of certain tables from the exported database
527
+
$ wp db export --exclude_tables_data=wp_actionscheduler_logs
528
+
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
529
+
522
530
# Export database to STDOUT.
523
531
$ wp db export -
524
532
-- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
Copy file name to clipboardExpand all lines: src/DB_Command.php
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -710,6 +710,10 @@ public function query( $args, $assoc_args ) {
710
710
* [--exclude_tables=<tables>]
711
711
* : The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
712
712
*
713
+
* [--exclude_tables_data=<tables>]
714
+
* : The comma separated list of specific tables for which only the structure will be exported. Excluding this parameter will export data for all tables in the export.
715
+
* Requires a dump client that supports --ignore-table-data (mariadb-dump from MariaDB 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.3 or later); MySQL's mysqldump does not. Cannot be combined with --tables.
716
+
*
713
717
* [--include-tablespaces]
714
718
* : Skips adding the default --no-tablespaces option to mysqldump.
715
719
*
@@ -757,6 +761,10 @@ public function query( $args, $assoc_args ) {
757
761
* $ wp db export --exclude_tables=$(wp db tables --all-tables-with-prefix --format=csv)
758
762
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
759
763
*
764
+
* # Skip data of certain tables from the exported database
765
+
* $ wp db export --exclude_tables_data=wp_actionscheduler_logs
766
+
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
767
+
*
760
768
* # Export database to STDOUT.
761
769
* $ wp db export -
762
770
* -- MySQL dump 10.13 Distrib 5.7.19, for osx10.12 (x86_64)
@@ -840,6 +848,8 @@ public function export( $args, $assoc_args ) {
// The dump client ignores --ignore-table-data for tables named with --tables.
878
+
if ( $has_tables ) {
879
+
WP_CLI::error( 'The --exclude_tables_data option cannot be combined with --tables.' );
880
+
}
881
+
882
+
// --ignore-table-data is a dump client option, so check the client rather than the server.
883
+
if ( ! $this->command_supports_option( $mysqldump_binary, 'ignore-table-data' ) ) {
884
+
WP_CLI::error( sprintf( 'The --exclude_tables_data option requires a dump client that supports --ignore-table-data (mariadb-dump from MariaDB 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.3 or later). "%s" does not.', $mysqldump_binary ) );
0 commit comments