WordPress Migration and Upgrade Review Skill
Overview
Systematic review for WordPress plugin and theme upgrade routines. Core principle: Upgrades should be repeatable, version-aware, incremental, and safe on real production data. Review covers schema changes, option migrations, version flags, activation upgrades, background backfills, idempotency, rollback risk, and backwards compatibility.
When to Use
Use when:
- Reviewing schema or option migrations
- Auditing
dbDelta() usage
- Checking versioned upgrade routines
- Reviewing background backfills or one-time repair jobs
- Preparing a risky release for existing installs
Don't use for:
- Pure performance review without migration logic
- General plugin architecture review without upgrade context
- One-off content imports unrelated to product upgrades
Code Review Workflow
Identify migration surface
- Activation hook setup
- Version comparison upgrade routine
- Background backfill
- Manual repair tool
Check safety first
- Version guard present
- Routine is idempotent
- Destructive operations are explicit and justified
- Large data work is chunked
Review schema and data flow
dbDelta() vs raw SQL
- Option rename/copy/delete order
- Backfill durability and progress tracking
- Upgrade completion flags
Apply severity
- CRITICAL: No version guards, destructive writes without checks, long-running upgrade on page load
- WARNING: Missing batching, missing rollback consideration, untracked partial state
- INFO: Could use clearer migration registry or logging
File-Type Specific Checks
Versioned Upgrade Routines
- CRITICAL: Upgrade logic runs on every request without version compare
- WARNING: Multiple migration steps but no ordered upgrade map
- INFO: Could centralize migration registry
Schema Changes
- CRITICAL: Raw
CREATE TABLE or ALTER TABLE without care for existing installs
- WARNING:
dbDelta() used without table-version tracking
- INFO: Could separate schema and data migration phases
Data Backfills
- CRITICAL: Full-table backfill on normal page load
- WARNING: No batching or progress option
- WARNING: No retry or resumable design
- INFO: Could use Action Scheduler or WP-CLI support
Search Patterns for Quick Detection (MIG-21)
Use these rg commands for quick migration scanning.
CRITICAL Patterns
# Version comparisons and upgrade flags
rg -n "version_compare|get_option\s*\(.*version|update_option\s*\(.*version" . -g '*.php'
# Schema changes
rg -n "dbDelta|CREATE TABLE|ALTER TABLE|DROP TABLE" . -g '*.php'
# Activation and upgrade hooks
rg -n "register_activation_hook|upgrader_process_complete|admin_init|init" . -g '*.php'
WARNING Patterns
# Batch candidates and large loops
rg -n "foreach|while" . -g '*.php'
# Background processing and schedulers
rg -n "wp_schedule_event|as_schedule_single_action|WP_CLI" . -g '*.php'
# Delete or rename operations
rg -n "delete_option|rename|migrate|backfill" . -g '*.php'
INFO Patterns
# Upgrade classes or managers
rg -n "Migration|Upgrade|Installer|Schema" . -g '*.php'
Reference Files
references/versioned-upgrades.md - Version flags, ordered migrations, and idempotent upgrade routines
references/schema-and-backfill-guide.md - dbDelta(), table changes, backfills, batching, and release safety
Output Format (MIG-23)
For each finding include severity, file reference, migration risk, and a safe remediation path. Note explicitly if the issue risks production timeouts, partial data state, or irreversible data loss.
1---2name: wp-migration-upgrade-review-23description: WordPress migration and upgrade review. Use when reviewing database migrations, option versioning, upgrade routines, data backfills, dbDelta usage, release compatibility, rollback risk, or when user mentions "migration review", "upgrade routine", "dbDelta", "plugin upgrade", "data migration", "version bump", "backfill", "schema change", or "backwards compatibility". Detects unsafe migrations, missing version guards, destructive data changes, and upgrade-flow risks in WordPress code.4---56# WordPress Migration and Upgrade Review Skill78## Overview910Systematic review for WordPress plugin and theme upgrade routines. **Core principle:** Upgrades should be repeatable, version-aware, incremental, and safe on real production data. Review covers schema changes, option migrations, version flags, activation upgrades, background backfills, idempotency, rollback risk, and backwards compatibility.1112## When to Use1314**Use when:**15- Reviewing schema or option migrations16- Auditing `dbDelta()` usage17- Checking versioned upgrade routines18- Reviewing background backfills or one-time repair jobs19- Preparing a risky release for existing installs2021**Don't use for:**22- Pure performance review without migration logic23- General plugin architecture review without upgrade context24- One-off content imports unrelated to product upgrades2526## Code Review Workflow27281. **Identify migration surface**29 - Activation hook setup30 - Version comparison upgrade routine31 - Background backfill32 - Manual repair tool33342. **Check safety first**35 - Version guard present36 - Routine is idempotent37 - Destructive operations are explicit and justified38 - Large data work is chunked39403. **Review schema and data flow**41 - `dbDelta()` vs raw SQL42 - Option rename/copy/delete order43 - Backfill durability and progress tracking44 - Upgrade completion flags45464. **Apply severity**47 - **CRITICAL:** No version guards, destructive writes without checks, long-running upgrade on page load48 - **WARNING:** Missing batching, missing rollback consideration, untracked partial state49 - **INFO:** Could use clearer migration registry or logging5051## File-Type Specific Checks5253### Versioned Upgrade Routines5455- CRITICAL: Upgrade logic runs on every request without version compare56- WARNING: Multiple migration steps but no ordered upgrade map57- INFO: Could centralize migration registry5859### Schema Changes6061- CRITICAL: Raw `CREATE TABLE` or `ALTER TABLE` without care for existing installs62- WARNING: `dbDelta()` used without table-version tracking63- INFO: Could separate schema and data migration phases6465### Data Backfills6667- CRITICAL: Full-table backfill on normal page load68- WARNING: No batching or progress option69- WARNING: No retry or resumable design70- INFO: Could use Action Scheduler or WP-CLI support7172## Search Patterns for Quick Detection (MIG-21)7374Use these `rg` commands for quick migration scanning.7576### CRITICAL Patterns7778```bash79# Version comparisons and upgrade flags80rg -n "version_compare|get_option\s*\(.*version|update_option\s*\(.*version" . -g '*.php'8182# Schema changes83rg -n "dbDelta|CREATE TABLE|ALTER TABLE|DROP TABLE" . -g '*.php'8485# Activation and upgrade hooks86rg -n "register_activation_hook|upgrader_process_complete|admin_init|init" . -g '*.php'87```8889### WARNING Patterns9091```bash92# Batch candidates and large loops93rg -n "foreach|while" . -g '*.php'9495# Background processing and schedulers96rg -n "wp_schedule_event|as_schedule_single_action|WP_CLI" . -g '*.php'9798# Delete or rename operations99rg -n "delete_option|rename|migrate|backfill" . -g '*.php'100```101102### INFO Patterns103104```bash105# Upgrade classes or managers106rg -n "Migration|Upgrade|Installer|Schema" . -g '*.php'107```108109## Reference Files110111- `references/versioned-upgrades.md` - Version flags, ordered migrations, and idempotent upgrade routines112- `references/schema-and-backfill-guide.md` - `dbDelta()`, table changes, backfills, batching, and release safety113114## Output Format (MIG-23)115116For each finding include severity, file reference, migration risk, and a safe remediation path. Note explicitly if the issue risks production timeouts, partial data state, or irreversible data loss.117