pub fn run_pending_migrations(data_dir: &Path) -> Result<usize, String>Expand description
Apply all pending migrations in-process before srv opens its stores.
Called unconditionally at srv startup so the shared store is fully backfilled
before id_store binds to it. This prevents apparent data loss (empty shared
store) on first boot after an upgrade. Fast-path: returns Ok(0) immediately
when all migrations are already applied.
Unlike run_migrate_command this writes progress via tracing rather than
stdout JSON and is meant to be called from within the daemon process rather
than a subprocess. Returns the number of migrations applied. On error, returns
Err — callers should fall back to the per-channel store rather than binding
id_store to an un-backfilled shared store.
data_dir must be the wave data dir (parent of db/), not the db dir.