Valkyrian Labs

Upgrading to 1.5

The database column for page outlines, and rollout notes for cross-page references and reference page chrome.

Upgrading to 1.5

1.5 stores each page's headings and reference entries at sync (the page outline), so :ref resolves across pages and docs sets, :::index{scope="set"} lists a whole docs set, docs pages get a rail, breadcrumbs and previous / next links, llms-full.txt gets a reference index, and the docsFind MCP tool can look up entries (Cross-Page References).

Database

Table Change
docs New column outline (JSON)
_docs_v The same column for versions (version_outline), only when docs drafts are on (target.enableDrafts)

The change is additive and needs no data step. Existing docs get outline = NULL until a sync renders them (see Rollout).

Upgrading from 1.4 needs this one migration. Without it the app fails to build or start with column docs.outline does not exist (or the same for _docs_v.version_outline). Upgrading from 1.3 needs the 1.4 migration as well.

With migrations, let Payload generate it from your config (the usual way; it also updates the migration snapshot):

1pnpm payload migrate:create docs_1_52pnpm payload migrate

Or add it by hand. The package ships the statements (Postgres, each with IF NOT EXISTS, the versions table with ALTER TABLE IF EXISTS), so a deploy that only runs payload migrate picks it up:

1// src/migrations/20261201_000000_docs_1_5.ts  (and list it in src/migrations/index.ts)2import { type MigrateDownArgs, type MigrateUpArgs, sql } from '@payloadcms/db-postgres'3import { docsOutlineMigrationSql } from 'payload-markdown-docs/migrations'4 5const statements = docsOutlineMigrationSql()6 7export async function up({ db }: MigrateUpArgs): Promise<void> {8  for (const statement of statements.up) await db.execute(sql.raw(statement))9}10 11export async function down({ db }: MigrateDownArgs): Promise<void> {12  for (const statement of statements.down) await db.execute(sql.raw(statement))13}

The statements:

1ALTER TABLE "docs" ADD COLUMN IF NOT EXISTS "outline" jsonb;2ALTER TABLE IF EXISTS "_docs_v" ADD COLUMN IF NOT EXISTS "version_outline" jsonb;

A hand-added migration does not update Payload's snapshot, so the next migrate:create lists the same column again; delete those lines from that generated file. Pass docsOutlineMigrationSql({ docsCollectionSlug }) when you changed the docs collection slug: table names follow it. Run the migration before the new version serves pages or syncs. Dev schema push applies the column on start. MongoDB needs nothing.

Rollout

  • Index the existing pages once. A sync stores outlines for the pages it renders, which are the pages it changes. After upgrading, run one full check so every page gets one: pmdocs push --full-check (or a sync with strict checks). Until then, cross-page :ref to an unchanged page is resolved by rendering that page during the sync (within the render budget), set indexes list only the pages that have an outline, and the rail shows headings only.
  • Sync checks off. With sync.diagnostics: false nothing is rendered at sync, so no outline is stored and pages cannot be :ref targets from other pages.
  • payload-markdown. Entries, :ref and :::index need payload-markdown 1.9.2 or later on the server. With an older payload-markdown the outlines have headings only and references stay text; everything else works as before.
  • Docs pages. Docs pages now show breadcrumbs, previous / next links and, on wide screens, an "On this page" rail. Turn any of them off with renderBreadcrumbs, renderPagination and renderRail (Route Adapter). From 1.5.1, breadcrumbs and previous / next defer to a layout that has its own: with renderSidebar={false} the page renders neither unless asked, and otherwise it hides the one the layout already shows. On 1.5.0 a site with its own docs layout shows both twice until it passes renderBreadcrumbs={false} and renderPagination={false}. A page that already has a ::toc keeps it on narrow screens; where the rail shows, the ::toc is hidden instead of appearing twice.
  • Older pmdocs. Nothing changes on the wire: the CLI prints unresolved-ref with the other server diagnostics, and strict checks reject a sync with a broken :ref for every client.
  • Agent skills. Run pmdocs skill update in docs repositories so agents learn the reference syntax and the scope="set" index.