wikidb.tracker.migrate

wikidb.tracker

migrate(db) -> changed, report_or_err

Bring a tracker's stored schemas up to this module's definition

An open tracker uses the schemas stored in its file, never this module's. A tracker made before a field existed refuses every write to that field with unknown field. A reindex does not help: it reads the same stale schema.

When a field this module declares is missing from the file, the stored schemas and indexes are replaced whole, and every collection is reindexed. A field this module has dropped does not survive. The report is { added, reindexed }: the missing schema.field names, and a { name, count } per collection. A file that has every field answers false, so a second run is quiet.

A context built before the call holds the old schema. Build a new one.