Skip to content

Conversation

Copy link

Copilot AI commented Oct 29, 2025

  • Add check-update-db method to Core_Command class
  • Implement logic to check if database update is needed (compare wp_db_version with current db_version)
  • Add support for --network flag for multisite installations
  • Add appropriate WP-CLI output messages
  • Update composer.json to register the new command
  • Create Behat feature tests for the new command
  • Address PR feedback:
    • Revert README.md (auto-generated file)
    • Fix composer.json semver version range
    • Fix code formatting alignment
  • Request code review and security scan (both passed with no issues)

Summary

Successfully implemented wp core check-update-db command that checks whether a WordPress database update is needed. The command:

  • Returns exit code 1 when update is needed, 0 when database is up to date
  • Compares wp_db_version with current db_version option
  • Supports --network flag to check all sites in a multisite installation
  • Follows the same patterns as existing wp core check-update command
  • Includes comprehensive Behat tests for single site and multisite scenarios

All PR feedback has been addressed.

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve DB update commands</issue_title>
<issue_description>We currently have a command wp core update-db that sometimes needs to be run after an update of Core.

It would be great to have a mechanism to check whether an update is actually needed.

Also, both commands might make more sense as wp db ... commands, instead of wp core ... commands.

Suggestion:

wp db check-update     Checks for the need for WordPress database updates.
wp db update           Runs the WordPress database update procedure.

Related issue: wp-cli/wp-cli#5085

cc @swissspidy </issue_description>

<agent_instructions>The new command should be wp core check-update-db, to align with wp core check-update</agent_instructions>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 29, 2025 20:27
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve DB update commands for WordPress Add wp core check-update-db command Oct 29, 2025
Copilot AI requested a review from swissspidy October 29, 2025 20:34
Copilot finished work on behalf of swissspidy October 29, 2025 20:34
@swissspidy
Copy link
Member

@copilot A couple of notes:

  • Do not modify README.md, this file is generated automatically.
  • Undo the composer/semver version range change in composer.json
  • There are a few formatting issues, you can fix them with composer phpcf (assuming that Composer dependencies are installed).

Copilot AI and others added 2 commits October 29, 2025 20:55
- Revert README.md changes (file is auto-generated)
- Restore composer/semver version range to "^1.4 || ^2 || ^3"

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

Copilot AI commented Oct 29, 2025

@copilot A couple of notes:

  • Do not modify README.md, this file is generated automatically.
    ...

Fixed in commits 2fdce40 and e5aef83:

  • Reverted README.md changes
  • Restored composer/semver version range to "^1.4 || ^2 || ^3"
  • Fixed variable assignment alignment to match existing code style

Copilot finished work on behalf of swissspidy October 29, 2025 20:58
@swissspidy swissspidy marked this pull request as ready for review October 30, 2025 15:18
@swissspidy swissspidy requested a review from a team as a code owner October 30, 2025 15:18
@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 2.2.0 milestone Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve DB update commands

2 participants