feat: refactor upgrade routine and add v0.6.0 migrations#321
feat: refactor upgrade routine and add v0.6.0 migrations#321
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the legacy credential migration into a versioned upgrade framework and introduces an activation-time upgrade trigger, with an additional v0.6.0 option rename migration.
Changes:
- Replaces the old
Credential_Migrationwith a newAdmin\Upgradesframework (Abstract_Upgrade,Upgrades, activation hook). - Moves the v0.5.0 credential migration logic into
Admin\Upgrades\V0_5_0and updates integration tests accordingly. - Adds a new v0.6.0 upgrade class to migrate
ai_experiment_*options towpai_*equivalents.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Integration/Includes/Migrations/Credential_MigrationTest.php | Updates integration tests to target the new V0_5_0 upgrade routine and version option key. |
| includes/bootstrap.php | Switches from direct migration call to Upgrades->init() and adds an activation hook to run upgrades. |
| includes/Migrations/Credential_Migration.php | Removes the legacy migration class (replaced by versioned upgrades). |
| includes/Admin/Upgrades/V0_5_0.php | Implements the v0.5.0 credential migration as an upgrade routine class. |
| includes/Admin/Upgrades/V0_6_0.php | Adds option migration logic for v0.6.0 (old ai_experiment_* → new wpai_*). |
| includes/Admin/Upgrades/Abstract_Upgrade.php | Introduces reusable base class for versioned upgrade routines with WP_Error reporting. |
| includes/Admin/Upgrades.php | Adds orchestrator that runs upgrade classes, stores DB version, and shows failure notice. |
| includes/Admin/Activation.php | Adds activation callback that triggers upgrades during plugin activation. |
💡 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.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #321 +/- ##
=============================================
+ Coverage 57.05% 57.48% +0.42%
- Complexity 591 610 +19
=============================================
Files 42 46 +4
Lines 3083 3147 +64
=============================================
+ Hits 1759 1809 +50
- Misses 1324 1338 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
|
Tests backfilled 🚀 |
What?
This PR creates a new
Upgradesroutine to handle scalable plugin upgrades and data migrations. Additionally it:WordPress/AI/Admin/Upgrades/V0_6_0for migrating theai_experiments_*=>wpai_feature_*options changed in feat!: RefactorExperimentsto be a type ofFeature#316Migrations/Credential_MigrationtoAdmin/Upgrades/V0_5_0.Why?
A central and future-compatible way to scale plugin upgrades.
How?
admin_initas a fallback), theUpgradesroutine checks gets the db version, and checks if anyAbstract_Upgradeclasses need to run, by comparing it with theAbstract_Upgrade::$versionAbstract_Upgrade::$version. If it fails, then the Upgrade routine stops and an admin notice is displayed.Todo
Use of AI Tools
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast