The migrator is a Sourcegraph service responsible for managing the state of the pgsql, codeintel-db, and codeinsights-db database schemas.
In standard Kubernetes or Docker-compose deployments, migrator runs automatically with the up command during startup (e.g., as an initContainer in Kubernetes). The frontend service will not start until the migrator exits successfully.
Version Guidance:
- For the default
up command: Always use the migrator image version that corresponds exactly with the Sourcegraph version being deployed. - For manual commands (
upgrade, downgrade, drift, run-out-of-band-migrations): Always use the latest migrator image release, even when targeting older Sourcegraph instances (supported back to v3.20.x).