(db: Db, ns: MigrationNamespace, names: readonly string[]): Promise<void> Insert tracker rows for the named migrations of a namespace without executing them.
Used to promote an existing schema (e.g. produced by a pre-0.42 build,
preserved through a tracker-shape upgrade) into the new identity tracker.
baseline() trusts the operator-supplied list — it does not verify that
the schema actually matches what the named migrations would have produced.
Pair with a schema-assertion script post-baseline before re-enabling traffic.
Contract:
- Probes for the pre-0.42 tracker shape; throws old-tracker-shape if
found (DDL with IF NOT EXISTS would otherwise no-op against the old
table and the INSERT would fail with a confusing column-not-found).
- Creates the new-shape schema_version table if missing — cutover
scripts that just dropped the old-shape table can call baseline()
directly with no separate DDL step.
- Acquires the same per-namespace advisory lock as run_migrations (with
the same try/catch fallback for environments lacking pg_advisory_lock).
- Refuses if any tracker rows already exist *for this namespace* — lets
multi-call baseline scripts resume after partial failure (completed
namespaces guard themselves while remaining ones still run).
- Verifies the supplied names are a strict prefix of the namespace's
current migrations array — a name not in the array, or out of order,
errors before any INSERT.
- Writes sequences 0..N-1 in one transaction.
db
the database instance
ns
the namespace whose migrations are being baselined
names
prefix of ns.migrations[].name to record as already-applied
readonly string[]returns
Promise<void> throws
MigrationError- with `kind` of `old-tracker-shape`,