Skip to content

Commit 45ec486

Browse files
committed
Fixes #209
I haven't tested the behat as I didn't get it working yet.
1 parent ca8894a commit 45ec486

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

features/db-columns.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ Feature: Display information about a given table.
4040
"""
4141
Couldn't find any tables matching: wp_foobar
4242
"""
43+
44+
Scenario: Display information about non-existing table
45+
Given a WP install
46+
And I run `wp db query "CREATE TABLE wp_not ( id int(11) unsigned NOT NULL AUTO_INCREMENT, awesome_stuff TEXT, PRIMARY KEY (id) );"`
47+
48+
When I try `wp db columns wp_not`
49+
Then STDOUT should be a table containing rows:
50+
| Field | Type | Null | Key | Default | Extra |
51+
| id | int(11) unsigned | NO | PRI | | auto_increment |
52+
| awesome_stuff | text | YES | | | |

src/DB_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,7 @@ public function columns( $args, $assoc_args ) {
15131513

15141514
$format = Utils\get_flag_value( $assoc_args, 'format' );
15151515

1516-
Utils\wp_get_table_names( [ $args[0] ], [] );
1516+
Utils\wp_get_table_names( [ $args[0] ], [ 'all-tables' => true ] );
15171517

15181518
$columns = $wpdb->get_results(
15191519
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Asserted to be a valid table name through wp_get_table_names.

0 commit comments

Comments
 (0)