Files
pr-vision/includes/core/class-prv-upgrader.php
peptiderepo 2fcef7a323 PR Vision v0.2.0: admin/settings interface + correctness fixes (#3)
Model manager (UI-swappable models) + versioned/idempotent prv_models migration; metric comparability (config-version stamping); run-lock; projected cost + truncation state; per-model run-health; cadence reschedule; API-key 3-state; design/a11y fixes (dark v2).

QA: APPROVE-WITH-P2-NOTES — qa-reviews/pr-vision/2026-06-14-ee4371d9163f992f60e09c7e4ac6cf8cd1d3c5eb.md

Agent-Session: pr-vision admin v0.2.0 merge
2026-06-14 14:48:25 +07:00

41 lines
1.2 KiB
PHP

<?php
/**
* Upgrade runner: idempotent, version-gated migrations.
*
* @package PrVision
*/
declare(strict_types=1);
/**
* Runs pending data migrations on every plugins_loaded call.
*
* Each migration is version-gated (cheap option check first) so it only
* runs when truly needed. Safe to call repeatedly -- all migrations are
* idempotent. This fires on UPGRADE (not just activation), so the plugin
* running live on prod without a fresh activation still gets migrated.
*
* Who triggers: PRV_Plugin::init() at plugins_loaded priority 1.
* Dependencies: PRV_Model_Registry, PRV_Config_Version.
*
* @see class-prv-model-registry.php -- Migration v2 implementation.
* @see class-prv-config-version.php -- Scoring-config versioning.
* @see class-prv-plugin.php -- Calls PRV_Upgrader::run().
* @package PrVision
*/
class PRV_Upgrader {
/**
* Run all pending migrations in version order.
*
* Side effects: May write to wp_options (migration state).
*
* @return void
*/
public static function run(): void {
PRV_Table_Manager::create_table();
PRV_Model_Registry::run_migration_v2();
PRV_Config_Version::maybe_seed_initial_version();
}
}