Skip to content

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

Merged
swissspidy merged 4 commits intomainfrom
copilot/update-documentation-allowed-values
Mar 16, 2026
Merged

Support table-qualified column names in --skip-columns and --include-columns#214
swissspidy merged 4 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.

@github-actions github-actions bot added command:search-replace Related to 'search-replace' command scope:documentation Related to documentation labels Mar 14, 2026
@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 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
Contributor

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.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy
Copy link
Member

@copilot unexpected test failure:

001 Scenario: Suppress report or only report changes on export to file # features/search-replace-export.feature:284
      And STDOUT should be a table containing rows:                    # features/search-replace-export.feature:305

        --- Expected
        +++ Actual
        @@ @@
        -wp_commentmeta	meta_id	0	PHP
        +wp_commentmeta	comment_id	0	PHP
        +wp_commentmeta	meta_key	0	PHP
        +wp_commentmeta	meta_value	0	PHP

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy swissspidy added this to the 2.1.10 milestone Mar 16, 2026
@swissspidy swissspidy merged commit 281a49c into main Mar 16, 2026
60 checks passed
@swissspidy swissspidy deleted the copilot/update-documentation-allowed-values branch March 16, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:search-replace Related to 'search-replace' command scope:documentation Related to documentation

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