Skip to content

Support table-qualified column names in --skip-columns and --include-columns#214

Open
Copilot wants to merge 2 commits intomainfrom
copilot/update-documentation-allowed-values
Open

Support table-qualified column names in --skip-columns and --include-columns#214
Copilot wants to merge 2 commits intomainfrom
copilot/update-documentation-allowed-values

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

--skip-columns and --include-columns silently ignored table-qualified column names like wp_posts.guid, with no documentation indicating this format was unsupported. This adds first-class support for the table.column syntax.

Changes

  • SQL processing path: Both include_columns and skip_columns checks now match against column and table.column formats
  • PHP export path: Same table-qualified matching added; also adds the previously missing include_columns filtering (pre-existing omission)
  • Docblock: Both parameters now document table-qualified name support

Usage

# Skip guid only in wp_posts, not in other tables that also have a guid column
wp search-replace 'http://old.com' 'http://new.com' --skip-columns=wp_posts.guid

# Restrict replacement to post_content in wp_posts only
wp search-replace 'http://old.com' 'http://new.com' --include-columns=wp_posts.post_content

# Mix plain and table-qualified names
wp search-replace 'http://old.com' 'http://new.com' --skip-columns=user_pass,wp_posts.guid

Plain column names (e.g. --skip-columns=guid) continue to work as before and match across all tables.

Original prompt

This section details on the original issue you should resolve

<issue_title>Clarify the allowed values for --skip-columns and --include-columns</issue_title>
<issue_description>It's not clear from the documentation whether a fully qualified column name is allowed in the --skip-columns and --include-columns arguments, for example --skip-columns=wp_posts.guid.

This format is not supported, so I think the documentation should be updated to make this clear.</issue_description>

Comments on the Issue (you are @copilot in this section)

@schlessera @dasbuilder Would you mind opening a separate issue for the above? This looks like a bug we should investigate.

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Search_Replace_Command.php 66.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…columns

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Clarify allowed values for --skip-columns and --include-columns Support table-qualified column names in --skip-columns and --include-columns Mar 14, 2026
Copilot AI requested a review from swissspidy March 14, 2026 22:39
@swissspidy swissspidy marked this pull request as ready for review March 15, 2026 08:40
@swissspidy swissspidy requested a review from a team as a code owner March 15, 2026 08:40
Copilot AI review requested due to automatic review settings March 15, 2026 08:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates wp search-replace to treat --skip-columns and --include-columns entries as matching either unqualified column names (column) or table-qualified names (table.column), fixing the long-standing behavior where qualified names were silently ignored.

Changes:

  • Extend include/skip column matching in the main processing loop to also recognize table.column.
  • Apply the same qualified matching in the SQL export (PHP) path and add missing --include-columns handling there.
  • Update command option docs and add Behat coverage for table-qualified include/skip usage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Search_Replace_Command.php Adds table-qualified matching for include/skip columns in both processing and export paths; updates option docs.
features/search-replace.feature Adds acceptance tests ensuring table.column works for --skip-columns and --include-columns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +618 to +622
if ( ! empty( $this->include_columns ) && ! in_array( $col, $this->include_columns, true ) && ! in_array( $table . '.' . $col, $this->include_columns, true ) ) {
$row_fields[ $col ] = $value;
continue;
}
if ( $value && ! in_array( $col, $primary_keys, true ) && ! in_array( $col, $this->skip_columns, true ) && ! in_array( $table . '.' . $col, $this->skip_columns, true ) ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify the allowed values for --skip-columns and --include-columns

3 participants