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

Add `db columns` command #100

Merged
merged 10 commits into from May 15, 2018

Conversation

2 participants
@swissspidy
Copy link
Member

swissspidy commented May 2, 2018

Implements wp-cli/ideas#97.

Not sure if it's worth adding to the package, but I figured it might be useful.

swissspidy added some commits May 2, 2018

$format = WP_CLI\Utils\get_flag_value( $assoc_args, 'format' );
WP_CLI\Utils\wp_get_table_names( [ $args[0] ], [] );

This comment has been minimized.

@swissspidy

swissspidy May 2, 2018

Author Member

Needs to use array() syntax.

@@ -0,0 +1,40 @@
Feature: Display information about a given table.

Scenario: Display information about the wp_posts table

This comment has been minimized.

@swissspidy

swissspidy May 2, 2018

Author Member

Schema might not be the same for older WordPress versions. A minimum version should be added.

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

I think the last change to the database schema was for WP 4.2, so adding the following should work: @require-wp-4.2

'format' => $format,
);
$formatter = new Formatter($formatter_args, array( 'Field', 'Type', 'Null', 'Key', 'Default', 'Extra' ) );

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

CS - Space missing before $formatter_args.

* +-----------------------+---------------------+------+-----+---------------------+----------------+
*
* @when after_wp_load
* @alias fields

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

We should skip the alias and only use multiple names for BC reasons.

@@ -0,0 +1,40 @@
Feature: Display information about a given table.

Scenario: Display information about the wp_posts table

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

I think the last change to the database schema was for WP 4.2, so adding the following should work: @require-wp-4.2

README.md Outdated
### wp db columns
Display information about a given table.

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

Display => Displays

README.md Outdated
**OPTIONS**
[<table>]
Table name

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

Table name => Name of the database table.

README.md Outdated
Table name
[--format]
table, csv, json

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

Add description:

Render output in a particular format.
README.md Outdated
[<table>]
Table name
[--format]

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

Should be: [--format=<format>]

options:
- table
- csv
- json

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

Should include yaml

'format' => $format,
);
$formatter = new Formatter($formatter_args, array( 'Field', 'Type', 'Null', 'Key', 'Default', 'Extra' ) );

This comment has been minimized.

@schlessera

schlessera May 8, 2018

Member

Given $formatter_args is built in a separate variable, the header fields should get the same treatment, especially as they produce a very long line here.

@schlessera

This comment has been minimized.

Copy link
Member

schlessera commented May 8, 2018

You should also adapt the file https://github.com/wp-cli/db-command/blob/master/.github/settings.yml to add the command:db-columns to the settings.

swissspidy added some commits May 8, 2018

@swissspidy swissspidy requested a review from schlessera May 9, 2018

@schlessera schlessera merged commit c9b7a5e into master May 15, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@schlessera schlessera deleted the show-columns branch May 15, 2018

@schlessera schlessera added this to the 1.3.4 milestone May 15, 2018

@schlessera schlessera changed the title Show columns Add `db columns` command May 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
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.